Created
November 28, 2017 06:31
-
-
Save cpbotha/0a4aaa99f986c9b70c038a55963261c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; cpbotha's not so nice elpy init | |
(use-package elpy | |
:commands (elpy-enable) ;; this will ensure lazy loading | |
:config | |
(progn | |
(message "LAZY loading elpy") | |
(elpy-enable) | |
;; elpy is mightily confused by ipython 5.2 so we disable it | |
;; (elpy-use-ipython) | |
(define-key elpy-mode-map (kbd "C-M-n") 'elpy-nav-forward-block) | |
(define-key elpy-mode-map (kbd "C-M-p") 'elpy-nav-backward-block) | |
)) | |
;; call elpy-enable only the first time a python file is opened | |
;; this will in turn trigger the loading of elpy via use-package | |
(setq elpy-loaded nil) | |
(add-hook 'python-mode-hook | |
(lambda () | |
(setq prettify-symbols-alist '(("lambda" . 955))) | |
(company-mode 1) | |
(when (not elpy-loaded) | |
(setq elpy-loaded t) | |
(elpy-enable) | |
;; here we're already inside the first python-mode-hook invocation | |
;; we've just installed elpy-enable's own python-mode-hook, but | |
;; that will only get triggered the NEXT time, so here we manually | |
;; activate elpy-mode | |
;; I don't know if lazy loading elpy is worth all this extra code. | |
(elpy-mode)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks so much for this! Just wondering, what did you set your company-mode idle delay timer to?
I've been experiencing severe lag when ob-ipython tries to obtain completion candidates, and it seems that company-mode isn't async yet. Really appreciate all the help thus far.