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. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(package-selected-packages '(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
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; 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. ;; Default mode definitions.
;;; Code:
;; Easier to identify identifiers ;; Easier to identify identifiers
(use-package rainbow-identifiers (use-package rainbow-identifiers
:ensure t :ensure t
@ -13,7 +14,11 @@
;; Company is enabled globally. ;; Company is enabled globally.
(use-package company (use-package company
:ensure t :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 (use-package projectile
:ensure t :ensure t

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

@ -19,14 +19,30 @@
(pyenv-mode-set pyenv-current-version) (pyenv-mode-set pyenv-current-version)
(message (concat "Setting virtualenv to " 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. ;; For Python enable Elpy.
(use-package elpy (use-package elpy
:ensure t :ensure t
:init (elpy-enable)) :requires jedi
(setq elpy-rpc-backend "jedi") :init
(setq jedi:complete-on-dot t) (elpy-enable)
;; Enable pyenv integration. (setq elpy-rpc-backend "jedi"))
;; Enable pyenv integration.
(if (executable-find "pyenv") (if (executable-find "pyenv")
(use-package pyenv-mode (use-package pyenv-mode
:ensure t :ensure t
@ -49,10 +65,6 @@
(if (executable-find "pyenv") (if (executable-find "pyenv")
(add-hook 'python-mode-hook 'pyenv-activate-current-project)) (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 ;; Use microsoft's python language server
(add-hook 'python-mode-hook (lambda () (lsp-python-enable))) (add-hook 'python-mode-hook (lambda () (lsp-python-enable)))
(use-package lsp-python-ms (use-package lsp-python-ms

Loading…
Cancel
Save