doomemacs/init/init-python.el

33 lines
980 B
EmacsLisp
Raw Normal View History

2014-09-06 05:08:40 +08:00
(provide 'init-python)
(use-package python
:mode ("\\.py\\'" . python-mode)
:interpreter ("python" . python-mode)
2014-09-21 04:54:04 +08:00
:init
(setq python-indent-offset 4)
2014-09-06 05:08:40 +08:00
:config
(progn
2014-09-21 04:54:04 +08:00
(use-package jedi)
2014-09-06 05:08:40 +08:00
2014-09-21 04:54:04 +08:00
(unless (file-directory-p "~/.emacs.d/.python-environments/default/")
(jedi:install-server))
2014-09-06 05:08:40 +08:00
2014-09-21 04:54:04 +08:00
(add-hook 'python-mode-hook 'jedi:ac-setup)
(setq python-shell-interpreter "ipython")
2014-09-06 05:08:40 +08:00
2014-10-10 06:37:37 +08:00
;; Interferes with smartparens
2014-09-21 04:54:04 +08:00
(defmap python-mode-map (kbd "DEL") nil)
2014-09-06 05:08:40 +08:00
2014-09-21 04:54:04 +08:00
(add-hook! 'python-mode-hook
(setq my-switch-to-repl-func 'python-shell-switch-to-shell
my-send-region-to-repl-func 'python-shell-send-region
my-run-code-interpreter "python"))
2014-09-06 05:08:40 +08:00
2014-09-21 04:54:04 +08:00
(use-package nose
:commands (nose-mode)
2014-09-06 05:08:40 +08:00
:init
2014-09-21 04:54:04 +08:00
(progn
;; Reset nose keymap, we'll set new ones in my-keymaps.el
(defvar nose-mode-map (make-sparse-keymap))
(associate-minor-mode "/test_.+\\.py\\'" nose-mode)))))