Skip to content

Instantly share code, notes, and snippets.

@cpbotha
Created November 28, 2017 06:31
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cpbotha/0a4aaa99f986c9b70c038a55963261c4 to your computer and use it in GitHub Desktop.
;; 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))))
@jakejx
Copy link

jakejx commented Nov 28, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment