              (run-python)
              (python-shell-switch-to-shell)))))
 
-;; Default yanking in python sucks ballz. I had to rewrite my own
-;; function for it. It's really hard to infer how one should do the
-;; indentation. This functions assumes that you hit C-y at the level
-;; you want.
-(defun nsv/python-yank (arg)
-  "Yank and reindent python code, with ARG, dont reindent."
-  (interactive "P")
-  (yank)
-  (when arg
-    (save-excursion
-      (exchange-point-and-mark)
-      (forward-line 1)
-      (let ((times (count-lines (region-beginning) (region-end))))
-        (deactivate-mark)
-        (dotimes (i times)
-          (indent-for-tab-command)
-          (when (< i times)
-            (forward-line 1)))))))
-
-
 ;; Add tweaks to standard python.el defined in this file.
 (defun nsv/python-rebinds ()
   "Add the functions defined in python-programming.el to Python buffer locally."
-  ;; Basic commands
-  (define-key python-mode-map (kbd "C-y") #'nsv/python-yank)
   ;; Shell related commands
   (local-set-key (kbd "C-c C-z") #'nsv/python-switch-to-shell)
   (local-set-key (kbd "C-c C-r") #'spacemacs/python-execute-file)


(define-key python-mode-map (kbd "C-c C-e") 'nsv/python-debug)

;; Try out fakegir
(when (file-exists-p "~/.cache/fakegir")
  (add-to-list 'python-shell-extra-pythonpaths "~/.cache/fakegir"))

;; python-django seems to work quite ok with it.
(use-package python-django
  :ensure t)

;; Trying out my new package
(when (file-exists-p "/home/nsalas/forks/importmagic.el")
  (require 'importmagic)
  (add-hook 'python-mode-hook 'importmagic-mode)
  (define-key python-mode-map (kbd "C-c C-f") nil)
  (define-key importmagic-mode-map (kbd "C-c C-f") 'importmagic-fix-imports))

;; Diminish it to free up mode line space.
(diminish 'importmagic-mode)

;; Also get rid of the annoying buffers for ivy and helm.
(with-eval-after-load 'helm

;; Python needs indentation, Emacs should help
(add-hook 'python-mode-hook #'indent-guide-mode)

;; Been using paredit in this thing
(define-key python-mode-map (kbd "C-)") #'paredit-forward-slurp-sexp)

