Browse Source

Update some python stuff, company-mode global test.

master
Taylor Bockman 2 years ago
parent
commit
311ce46575
  1. 2
      elisp/custom.el
  2. 7
      elisp/modes/default-modes.el
  3. 28
      elisp/modes/python-mode-settings.el

2
elisp/custom.el

@ -4,7 +4,7 @@
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(hl-defined counsel rainbow-identifiers exwm-config all-the-icons-ibuffer slime ivy zerodark-theme zerodark neotree all-the-icons paredit flycheck aggressive-indent aggressive-indent-mode lsp-python-ms py-autopep8 pyenv-mode elpy lsp-ui use-package)))
'(company-jedi jedi hl-defined counsel rainbow-identifiers exwm-config all-the-icons-ibuffer slime ivy zerodark-theme zerodark neotree all-the-icons paredit flycheck aggressive-indent aggressive-indent-mode lsp-python-ms py-autopep8 pyenv-mode elpy lsp-ui use-package)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.

7
elisp/modes/default-modes.el

@ -1,5 +1,6 @@
;; Default mode definitions.
;;; Code:
;; Easier to identify identifiers
(use-package rainbow-identifiers
:ensure t
@ -13,7 +14,11 @@
;; Company is enabled globally.
(use-package company
:ensure t
:hook ((after-init . global-company-mode)))
:hook ((after-init . global-company-mode))
:config ;; backend setting must be done only after load.
(push 'company-files company-backends)
(push 'company-keywords company-backends)
(push 'company-capf company-backends))
(use-package projectile
:ensure t

28
elisp/modes/python-mode-settings.el

@ -19,14 +19,30 @@
(pyenv-mode-set pyenv-current-version)
(message (concat "Setting virtualenv to " pyenv-current-version))))))))
;; Right now this will require M-x jedi:install-server
;; to use it in a project.
;; TODO: Do the server installation automatically.
(use-package jedi
:ensure t
:hook (python-mode . jedi:setup)
:init
(setq jedi:complete-on-dot t))
(use-package company-jedi
:ensure t
:requires jedi
:hook (python-mode . company-jedi))
;; For Python enable Elpy.
(use-package elpy
:ensure t
:init (elpy-enable))
(setq elpy-rpc-backend "jedi")
(setq jedi:complete-on-dot t)
;; Enable pyenv integration.
:requires jedi
:init
(elpy-enable)
(setq elpy-rpc-backend "jedi"))
;; Enable pyenv integration.
(if (executable-find "pyenv")
(use-package pyenv-mode
:ensure t
@ -49,10 +65,6 @@
(if (executable-find "pyenv")
(add-hook 'python-mode-hook 'pyenv-activate-current-project))
;; Add company-jedi hook to python mode
(add-hook 'python-mode-hook (lambda ()
(add-to-list 'company-backends 'company-jedi)))
;; Use microsoft's python language server
(add-hook 'python-mode-hook (lambda () (lsp-python-enable)))
(use-package lsp-python-ms

Loading…
Cancel
Save