corfu config
This commit is contained in:
parent
0ea86ed3da
commit
8b36fd2adf
99
init.org
99
init.org
|
@ -1188,6 +1188,7 @@ Auto-completion using =corfu=:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package corfu
|
(use-package corfu
|
||||||
:straight t
|
:straight t
|
||||||
|
:hook ((prog-mode text-mode) . completion-preview-mode)
|
||||||
:custom
|
:custom
|
||||||
;; Enable auto completion
|
;; Enable auto completion
|
||||||
(corfu-auto t)
|
(corfu-auto t)
|
||||||
|
@ -1202,6 +1203,16 @@ Auto-completion using =corfu=:
|
||||||
;; Preselect the first suggestion
|
;; Preselect the first suggestion
|
||||||
(corfu-preselect 'first)
|
(corfu-preselect 'first)
|
||||||
(corfu-on-exact-match nil)
|
(corfu-on-exact-match nil)
|
||||||
|
:custom
|
||||||
|
(lsp-completion-provider :none)
|
||||||
|
:init
|
||||||
|
(defun nemo/orderless-dispatch-flex-first (_pattern index _total)
|
||||||
|
(and (eq index 0) 'orderless-flex))
|
||||||
|
|
||||||
|
(defun nemo/lsp-mode-setup-completion ()
|
||||||
|
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) '(orderless))
|
||||||
|
(add-hook 'orderless-style-dispatchers #'nemo/orderless-dispatch-flex-first nil 'local))
|
||||||
|
:hook (lsp-completion-mode . nemo/lsp-mode-setup-completion)
|
||||||
:config
|
:config
|
||||||
(global-corfu-mode))
|
(global-corfu-mode))
|
||||||
|
|
||||||
|
@ -1214,26 +1225,28 @@ Auto-completion using =corfu=:
|
||||||
(if (display-graphic-p) -1 +1))))
|
(if (display-graphic-p) -1 +1))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package emacs
|
;; (use-package emacs
|
||||||
;; :custom
|
;; ;; :custom
|
||||||
;; TODO
|
;; ;; TODO
|
||||||
:init
|
;; :init
|
||||||
;; TAB cycle if there are only few candidates
|
;; ;; TAB cycle if there are only few candidates
|
||||||
;; (setq completion-cycle-threshold 3)
|
;; ;; (setq completion-cycle-threshold 3)
|
||||||
|
|
||||||
(setq enable-recursive-minibuffers t)
|
;; (setq enable-recursive-minibuffers t)
|
||||||
;; Hide commands in M-x which do not apply to the current mode. Corfu
|
;; ;; Hide commands in M-x which do not apply to the current mode. Corfu
|
||||||
;; commands are hidden, since they are not supposed to be used via M-x.
|
;; ;; commands are hidden, since they are not supposed to be used via M-x.
|
||||||
(setq read-extended-command-predicate
|
;; (setq read-extended-command-predicate
|
||||||
#'command-completion-default-include-p)
|
;; #'command-completion-default-include-p)
|
||||||
|
|
||||||
(setq text-mode-ispell-word-completion nil)
|
;; (setq text-mode-ispell-word-completion nil)
|
||||||
|
|
||||||
;; Enable indentation+completion using the TAB key.
|
;; ;; Enable indentation+completion using the TAB key.
|
||||||
;; `completion-at-point' is often bound to M-TAB.
|
;; ;; `completion-at-point' is often bound to M-TAB.
|
||||||
(setq tab-always-indent 'complete))
|
;; (setq tab-always-indent 'complete)
|
||||||
|
;; )
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
*** kind-icon
|
||||||
Use =kind-icon= to decorate corfu completion candidates:
|
Use =kind-icon= to decorate corfu completion candidates:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package kind-icon
|
(use-package kind-icon
|
||||||
|
@ -1243,37 +1256,38 @@ Use =kind-icon= to decorate corfu completion candidates:
|
||||||
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
|
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
This package seems to slow down search quite a bit in common buffers like find-file and exectue-extended-comand:
|
*** Cape
|
||||||
#+begin_src emacs-lisp :tangle no
|
This package seems to slow down search quite a bit in common buffers like =find-file= and =exectue-extended-comand=:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
(use-package cape
|
(use-package cape
|
||||||
:straight t
|
:straight t
|
||||||
;; Bind dedicated completion commands
|
;; Bind dedicated completion commands
|
||||||
;; Alternative prefix keys: C-c p, M-p, M-+, ...
|
;; Alternative prefix keys: C-c p, M-p, M-+, ...
|
||||||
:bind (("C-c p p" . completion-at-point) ;; capf
|
;; :bind (("C-c p p" . completion-at-point) ;; capf
|
||||||
("C-c p t" . complete-tag) ;; etags
|
;; ("C-c p t" . complete-tag) ;; etags
|
||||||
("C-c p d" . cape-dabbrev) ;; or dabbrev-completion
|
;; ("C-c p d" . cape-dabbrev) ;; or dabbrev-completion
|
||||||
("C-c p h" . cape-history)
|
;; ("C-c p h" . cape-history)
|
||||||
("C-c p f" . cape-file)
|
;; ("C-c p f" . cape-file)
|
||||||
("C-c p k" . cape-keyword)
|
;; ("C-c p k" . cape-keyword)
|
||||||
("C-c p s" . cape-symbol)
|
;; ("C-c p s" . cape-symbol)
|
||||||
("C-c p a" . cape-abbrev)
|
;; ("C-c p a" . cape-abbrev)
|
||||||
("C-c p l" . cape-line)
|
;; ("C-c p l" . cape-line)
|
||||||
("C-c p w" . cape-dict)
|
;; ("C-c p w" . cape-dict)
|
||||||
("C-c p \\" . cape-tex)
|
;; ("C-c p \\" . cape-tex)
|
||||||
("C-c p _" . cape-tex)
|
;; ("C-c p _" . cape-tex)
|
||||||
("C-c p ^" . cape-tex)
|
;; ("C-c p ^" . cape-tex)
|
||||||
("C-c p &" . cape-sgml)
|
;; ("C-c p &" . cape-sgml)
|
||||||
("C-c p r" . cape-rfc1345))
|
;; ("C-c p r" . cape-rfc1345))
|
||||||
:init
|
:init
|
||||||
;; Add `completion-at-point-functions', used by `completion-at-point'.
|
;; Add `completion-at-point-functions', used by `completion-at-point'.
|
||||||
;; NOTE: The order matters!
|
;; NOTE: The order matters!
|
||||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
;; (add-to-list 'completion-at-point-functions #'cape-file)
|
||||||
(add-to-list 'completion-at-point-functions #'cape-elisp-block)
|
;; (add-to-list 'completion-at-point-functions #'cape-elisp-block)
|
||||||
(add-to-list 'completion-at-point-functions #'cape-history)
|
;; (add-to-list 'completion-at-point-functions #'cape-history)
|
||||||
(add-to-list 'completion-at-point-functions #'cape-keyword)
|
;; (add-to-list 'completion-at-point-functions #'cape-keyword)
|
||||||
(add-to-list 'completion-at-point-functions #'cape-tex)
|
;; (add-to-list 'completion-at-point-functions #'cape-tex)
|
||||||
(add-to-list 'completion-at-point-functions #'cape-dict)
|
;; (add-to-list 'completion-at-point-functions #'cape-dict)
|
||||||
;; (add-to-list 'completion-at-point-functions #'cape-sgml)
|
;; (add-to-list 'completion-at-point-functions #'cape-sgml)
|
||||||
;; (add-to-list 'completion-at-point-functions #'cape-rfc1345)
|
;; (add-to-list 'completion-at-point-functions #'cape-rfc1345)
|
||||||
;; (add-to-list 'completion-at-point-functions #'cape-abbrev)
|
;; (add-to-list 'completion-at-point-functions #'cape-abbrev)
|
||||||
|
@ -1282,6 +1296,7 @@ This package seems to slow down search quite a bit in common buffers like find-f
|
||||||
)
|
)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
*** Embark
|
||||||
Use =embark= for in-mini-buffer actions:
|
Use =embark= for in-mini-buffer actions:
|
||||||
#+begin_src emacs-lisp :tangle no
|
#+begin_src emacs-lisp :tangle no
|
||||||
(use-package embark
|
(use-package embark
|
||||||
|
@ -1297,6 +1312,7 @@ Use =embark= for in-mini-buffer actions:
|
||||||
:hook (embark-collect-mode . consult-preview-at-point-mode))
|
:hook (embark-collect-mode . consult-preview-at-point-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
*** COMMENT corfu + prescient
|
||||||
Use =corfu-prescient= to sort completion candidates:
|
Use =corfu-prescient= to sort completion candidates:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package corfu-prescient
|
(use-package corfu-prescient
|
||||||
|
@ -1306,7 +1322,7 @@ Use =corfu-prescient= to sort completion candidates:
|
||||||
;; :hook (corfu-mode . corfu-prescient-mode)
|
;; :hook (corfu-mode . corfu-prescient-mode)
|
||||||
;; :hook (text-mode . corfu-prescient-mode)
|
;; :hook (text-mode . corfu-prescient-mode)
|
||||||
:config
|
:config
|
||||||
(setq corfu-prescient-completion-styles '(prescient orderless basic partial-completion))
|
(setq corfu-prescient-completion-styles '(orderless prescient basic partial-completion))
|
||||||
(corfu-prescient-mode 1)
|
(corfu-prescient-mode 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1335,7 +1351,8 @@ Fuzzy and out-of-order completion matching using =orderless=:
|
||||||
(add-to-list 'completion-styles 'orderless)
|
(add-to-list 'completion-styles 'orderless)
|
||||||
(setq orderless-matching-styles '(orderless-flex)
|
(setq orderless-matching-styles '(orderless-flex)
|
||||||
completion-category-overrides '((file (styles basic partial-completion)))
|
completion-category-overrides '((file (styles basic partial-completion)))
|
||||||
orderless-component-separator "[ |]"))
|
orderless-component-separator "[ |]")
|
||||||
|
)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Programming
|
* Programming
|
||||||
|
|
Loading…
Reference in a new issue