enh-ruby-mode & anaconda-mode + better company support

This commit is contained in:
Henrik Lissner 2014-12-07 15:12:42 -05:00
parent dc97746803
commit 7d8c577f7c
3 changed files with 111 additions and 57 deletions

View file

@ -9,19 +9,76 @@
(setq python-environment-directory my-tmp-dir)
(setq python-shell-interpreter "ipython")
(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"))
;; Interferes with smartparens
(bind python-mode-map (kbd "DEL") nil)
(bind 'motion python-mode-map "gd" 'jedi:goto-definition)
(require 'jedi)
(unless (file-directory-p python-environment-directory)
(jedi:install-server))
(add-hook 'python-mode-hook 'jedi:ac-setup)
(use-package anaconda-mode
:init
(progn
(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'python-mode-hook 'eldoc-mode)
(add-hook! 'anaconda-mode-hook
(process-buffer (python-shell-get-or-create-process python-shell-interpreter t nil))))
:config
(progn
(bind 'motion anaconda-mode-map "gd" 'anaconda-mode-goto-definitions)
(bind 'normal anaconda-nav-mode-map [escape] 'anaconda-nav-quit)
(push '("*anaconda-doc*" :position bottom :height 15 :noselect t) popwin:special-display-config)
(push '("*anaconda-nav*" :position bottom :height 15 :stick t) popwin:special-display-config)
(push '("^\\*Python.+\\*$" :regexp t :position bottom :height 20 :noselect t) popwin:special-display-config)
;; Delete the window on escape or C-g
(defadvice anaconda-mode-doc-buffer (after anaconda-doc-buffer-escape-to-close activate)
(with-current-buffer (get-buffer "*anaconda-doc*")
(local-set-key [escape] 'anaconda-nav-quit)
(local-set-key [?\C-g] 'anaconda-nav-quit)))
(after "emr"
(emr-declare-command 'anaconda-mode-view-doc
:title "view documentation"
:modes 'python-mode
:predicate (lambda () (and (anaconda-mode-running-p)
(not (use-region-p))
(not (sp-point-in-string-or-comment)))))
(emr-declare-command 'anaconda-mode-goto-assignments
:title "go to assignments"
:modes 'python-mode
:predicate (lambda () (and (anaconda-mode-running-p)
(not (use-region-p))
(not (sp-point-in-string-or-comment)))))
(emr-declare-command 'anaconda-mode-goto-definitions
:title "go to definition"
:modes 'python-mode
:predicate (lambda () (and (anaconda-mode-running-p)
(not (use-region-p))
(not (sp-point-in-string-or-comment)))))
(emr-declare-command 'anaconda-mode-usages
:title "show usages"
:modes 'python-mode
:predicate (lambda () (and (anaconda-mode-running-p)
(not (use-region-p))
(not (sp-point-in-string-or-comment))))))
(after "auto-complete"
(use-package ac-anaconda
:init (add-hook 'python-mode-hook 'ac-anaconda-setup)))
(after "company"
(use-package company-anaconda
:config (company--backend-on 'python-mode-hook 'company-anaconda)))))
(use-package jedi
:disabled t
:config
(progn
(unless (file-directory-p python-environment-directory)
(jedi:install-server))
(add-hook 'python-mode-hook 'jedi:ac-setup)
(bind 'motion python-mode-map "gd" 'jedi:goto-definition)))
(use-package nose
:commands nose-mode