[emacs] Update emacs configuration.

This commit is contained in:
CAPELLE Mikaël 2020-01-13 14:30:07 +01:00
parent 3fc7b413b7
commit 9ac7dd7953
3 changed files with 45 additions and 48 deletions

View File

@ -48,6 +48,7 @@
(:map company-active-map
([tab] . smarter-yas-expand-next-field-complete)
("TAB" . smarter-yas-expand-next-field-complete))
("M-/" . company-complete)
:custom
(company-minimum-prefix-length 1)
(company-tooltip-align-annotations t)
@ -81,49 +82,49 @@ If failed try to complete the common part with `company-complete-common'"
;; -ComPac
;; CompanyLSPPac
(use-package company-lsp
:defer t
:custom (company-lsp-cache-candidates 'auto))
;; -CompanyLSPPac
;; (use-package company-lsp
;; :defer t
;; :custom (company-lsp-cache-candidates 'auto))
;; ;; -CompanyLSPPac
;; CompanyTabNinePac
(use-package company-tabnine
:defer 1
:custom
(company-tabnine-max-num-results 9)
:bind
(("M-q" . company-other-backend)
("C-z t" . company-tabnine))
:hook
(lsp-after-open . (lambda ()
(setq company-tabnine-max-num-results 3)
(add-to-list 'company-transformers 'company//sort-by-tabnine t)
(add-to-list 'company-backends '(company-lsp :with company-tabnine :separate))))
(kill-emacs . company-tabnine-kill-process)
:config
;; Enable TabNine on default
(add-to-list 'company-backends #'company-tabnine)
;; (use-package company-tabnine
;; :defer 1
;; :custom
;; (company-tabnine-max-num-results 9)
;; :bind
;; (("M-q" . company-other-backend)
;; ("C-z t" . company-tabnine))
;; :hook
;; (lsp-after-open . (lambda ()
;; (setq company-tabnine-max-num-results 3)
;; (add-to-list 'company-transformers 'company//sort-by-tabnine t)
;; (add-to-list 'company-backends '(company-lsp :with company-tabnine :separate))))
;; (kill-emacs . company-tabnine-kill-process)
;; :config
;; ;; Enable TabNine on default
;; (add-to-list 'company-backends #'company-tabnine)
;; Integrate company-tabnine with lsp-mode
(defun company//sort-by-tabnine (candidates)
(if (or (functionp company-backend)
(not (and (listp company-backend) (memq 'company-tabnine company-backend))))
candidates
(let ((candidates-table (make-hash-table :test #'equal))
candidates-lsp
candidates-tabnine)
(dolist (candidate candidates)
(if (eq (get-text-property 0 'company-backend candidate)
'company-tabnine)
(unless (gethash candidate candidates-table)
(push candidate candidates-tabnine))
(push candidate candidates-lsp)
(puthash candidate t candidates-table)))
(setq candidates-lsp (nreverse candidates-lsp))
(setq candidates-tabnine (nreverse candidates-tabnine))
(nconc (seq-take candidates-tabnine 3)
(seq-take candidates-lsp 6))))))
;; -CompanyTabNinePac
;; ;; Integrate company-tabnine with lsp-mode
;; (defun company//sort-by-tabnine (candidates)
;; (if (or (functionp company-backend)
;; (not (and (listp company-backend) (memq 'company-tabnine company-backend))))
;; candidates
;; (let ((candidates-table (make-hash-table :test #'equal))
;; candidates-lsp
;; candidates-tabnine)
;; (dolist (candidate candidates)
;; (if (eq (get-text-property 0 'company-backend candidate)
;; 'company-tabnine)
;; (unless (gethash candidate candidates-table)
;; (push candidate candidates-tabnine))
;; (push candidate candidates-lsp)
;; (puthash candidate t candidates-table)))
;; (setq candidates-lsp (nreverse candidates-lsp))
;; (setq candidates-tabnine (nreverse candidates-tabnine))
;; (nconc (seq-take candidates-tabnine 3)
;; (seq-take candidates-lsp 6))))))
;; ;; -CompanyTabNinePac
;; CompanyBoxPac
(use-package company-box

View File

@ -6,7 +6,7 @@
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 17:32:54 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Sat Dec 28 16:01:14 2019 (+0100)
;; Last-Updated: lun. janv. 13 10:50:18 2020 (+0100)
;; By: Mikaël Capelle
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d fonts
@ -44,6 +44,8 @@
;; Input Mono, Monaco Style, Line Height 1.3 download
;; from http://input.fontbureau.com/
(defvar font-list '(
("Fira Mono for Powerline" . 11)
("Fira Mono" . 11)
("Input" . 11)
("SF Mono" . 12)
("Consolas" . 12) ("Love LetterTW" . 12.5))

View File

@ -6,7 +6,7 @@
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Mon Jun 10 18:58:02 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Wed Jan 8 15:41:56 2020 (+0100)
;; Last-Updated: lun. janv. 13 14:24:17 2020 (+0100)
;; By: Mikaël Capelle
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: lsp-python-ms
@ -60,8 +60,6 @@
(flycheck-add-next-checker 'python-flake8 'python-mypy))
(use-package elpy
:after flycheck
:mode "\\.py\\'"
:custom
(flycheck-python-flake8-executable "python")
(python-indent-offset 4)
@ -70,13 +68,9 @@
:config
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode)
(add-to-list 'python-shell-completion-native-disabled-interpreters
"jupyter")
:init
(setq elpy-rpc-backend "jedi")
;; (setq elpy-rpc-python-command "I:\\Languages\\Python\\Python37\\python.exe")
(elpy-enable))
(add-hook 'python-mode-hook 'hs-minor-mode)
(use-package ein
:custom