doomemacs/modules/lang/python/config.el

74 lines
2.4 KiB
EmacsLisp
Raw Normal View History

2017-02-20 07:57:16 +08:00
;;; lang/python/config.el
2015-06-15 15:06:10 +08:00
(def-package! python
:commands python-mode
2015-06-15 15:06:10 +08:00
:init
2017-02-20 07:57:16 +08:00
(setq python-environment-directory doom-cache-dir
python-shell-interpreter "ipython"
python-shell-interpreter-args "--deep-reload"
python-shell-prompt-regexp "In \\[[0-9]+\\]: "
python-shell-prompt-block-regexp "\\.\\.\\.\\.: "
python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
python-shell-completion-setup-code
"from IPython.core.completerlib import module_completion"
python-shell-completion-string-code
"';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
(add-hook 'python-mode-hook 'flycheck-mode)
:config
(set! :repl 'python-mode '+python/repl)
(define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens
2015-06-15 15:06:10 +08:00
2017-02-20 07:57:16 +08:00
(def-package! anaconda-mode
:after python
:init
2017-02-20 07:57:16 +08:00
(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'anaconda-mode-hook 'anaconda-eldoc-mode)
(setq anaconda-mode-installation-directory (concat doom-cache-dir "anaconda/")
anaconda-mode-eldoc-as-single-line t)
2016-03-05 11:34:14 +08:00
:config
(set! :company-backend 'python-mode '(company-anaconda))
2017-02-20 07:57:16 +08:00
(map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions
2017-02-20 07:57:16 +08:00
:map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit)
2015-06-15 15:06:10 +08:00
2016-05-21 10:37:30 +08:00
(advice-add 'anaconda-mode-doc-buffer :after 'doom*anaconda-mode-doc-buffer))
2015-06-15 15:06:10 +08:00
(def-package! company-anaconda
:after anaconda-mode
:config
(set! :emr 'python-mode
2017-02-20 07:57:16 +08:00
'(:nv anaconda-mode-show-doc "view documentation")
'(:nv anaconda-mode-find-assignments "find assignments")
'(:nv anaconda-mode-find-definitions "find definitions")
'(:nv anaconda-mode-find-file "find assignments")
'(:n anaconda-mode-find-references "show usages")))
2015-06-15 15:06:10 +08:00
(def-package! pip-requirements
2017-02-20 07:57:16 +08:00
:mode ("/requirements.txt$" . pip-requirements-mode))
2016-04-19 14:38:58 +08:00
2017-02-20 07:57:16 +08:00
(def-package! nose
2016-04-05 00:06:47 +08:00
:commands nose-mode
2017-02-20 07:57:16 +08:00
:preface
(defvar nose-mode-map (make-sparse-keymap))
:init
(associate! nose-mode :match "/test_.+\\.py$" :in (python-mode))
2016-04-05 00:06:47 +08:00
:config
(set! :popup "*nosetests*" :size 0.4 :noselect t)
(set! :yas-minor-mode 'nose-mode)
(map! :map nose-mode-map
2017-02-20 07:57:16 +08:00
:localleader
:n "tr" 'nosetests-again
:n "ta" 'nosetests-all
:n "ts" 'nosetests-one
:n "tv" 'nosetests-module
:n "tA" 'nosetests-pdb-all
:n "tO" 'nosetests-pdb-one
:n "tV" 'nosetests-pdb-module))
2016-04-05 00:06:47 +08:00