feat(corfu): more CAPFs and ergonomy changes
Add various CAPFs from cape: - `cape-dabbrev`; - `cape-emoji`; - `cape-dict`; Fixed some CAPFs via cape: - Make non-exclusive, purified and silent `pcomplete-completions-at-point`; - Make non-exclusive and non-interruptable `lsp-completion-at-point`; - Make non-exclusive `eglot-completion-at-point`; - Make non-exclusive `comint-completion-at-point`; Fix and improve keybindings: - Smart `DEL`/`backspace` for `+tng`; - Smart `RET`; Add depth to CAPFs, allowing ordering to be adjustable. Enable in minibuffer.
This commit is contained in:
parent
1734697b62
commit
73d954c3b0
2 changed files with 113 additions and 24 deletions
|
@ -26,6 +26,14 @@ and highly non-native, but has some extra features and more maturity.
|
|||
- +orderless ::
|
||||
Pull in [[doom-package:orderless]] if necessary and apply multi-component
|
||||
completion (still needed if [[doom-module::completion vertico]] is active).
|
||||
- +dabbrev ::
|
||||
Enable and configure [[doom-package:dabbrev]] as a close-to-universal CAPF
|
||||
fallback.
|
||||
- +dict ::
|
||||
Enable and configure dictionary completion for text modes and related regions
|
||||
in programming modes.
|
||||
- +emoji ::
|
||||
Enable and configure emoji completion via the emoji input method.
|
||||
|
||||
** Packages
|
||||
- [[doom-package:corfu]]
|
||||
|
@ -63,26 +71,25 @@ By default, completion gets triggered after typing 2 non-space consecutive
|
|||
characters, or by means of the [[kbd:][C-SPC]] keybinding at any moment. While the popup
|
||||
is visible, the following relevant keys are available:
|
||||
|
||||
| Keybind | Description |
|
||||
|----------+------------------------------------------------------------------|
|
||||
| [[kbd:][<down>]] | Go to next candidate |
|
||||
| [[kbd:][<up>]] | Go to previous candidate |
|
||||
| [[kbd:][C-n]] | Go to next candidate |
|
||||
| [[kbd:][C-p]] | Go to previous candidate |
|
||||
| [[kbd:][C-j]] | (evil) Go to next candidate |
|
||||
| [[kbd:][C-k]] | (evil) Go to previous candidate |
|
||||
| [[kbd:][C-<down>]] | Go to next doc line |
|
||||
| [[kbd:][C-<up>]] | Go to previous doc line |
|
||||
| [[kbd:][C-S-n]] | Go to next doc line |
|
||||
| [[kbd:][C-S-p]] | Go to previous doc line |
|
||||
| [[kbd:][C-S-j]] | (evil) Go to next doc line |
|
||||
| [[kbd:][C-S-k]] | (evil) Go to previous doc line |
|
||||
| [[kbd:][C-h]] | Toggle documentation (if available) |
|
||||
| Keybind | Description |
|
||||
|----------+---------------------------------------------------------|
|
||||
| [[kbd:][<down>]] | Go to next candidate |
|
||||
| [[kbd:][<up>]] | Go to previous candidate |
|
||||
| [[kbd:][C-n]] | Go to next candidate |
|
||||
| [[kbd:][C-p]] | Go to previous candidate |
|
||||
| [[kbd:][C-j]] | (evil) Go to next candidate |
|
||||
| [[kbd:][C-k]] | (evil) Go to previous candidate |
|
||||
| [[kbd:][C-<down>]] | Go to next doc line |
|
||||
| [[kbd:][C-<up>]] | Go to previous doc line |
|
||||
| [[kbd:][C-S-n]] | Go to next doc line |
|
||||
| [[kbd:][C-S-p]] | Go to previous doc line |
|
||||
| [[kbd:][C-S-j]] | (evil) Go to next doc line |
|
||||
| [[kbd:][C-S-k]] | (evil) Go to previous doc line |
|
||||
| [[kbd:][C-h]] | Toggle documentation (if available) |
|
||||
| [[kbd:][M-m]] | Export to minibuffer (if [[doom-module::completion vertico]]) |
|
||||
| [[kbd:][M-S-j]] | (evil) Export to minibuffer (if [[doom-module::completion vertico]]) |
|
||||
| [[kbd:][RET]] | Insert candidate |
|
||||
| [[kbd:][SPC]] | (after wildcard) Reset completion |
|
||||
| [[kbd:][DEL]] | Reset completion |
|
||||
| [[kbd:][M-j]] | (evil) Export to minibuffer (if [[doom-module::completion vertico]]) |
|
||||
| [[kbd:][RET]] | Insert candidate |
|
||||
| [[kbd:][SPC]] | Quit autocompletion after a wildcard or pass-through |
|
||||
| [[kbd:][C-SPC]] | Complete (unless [[doom-module::completion corfu +tng]]) |
|
||||
| [[kbd:][C-SPC]] | (when completing) Insert separator DWIM (see below) |
|
||||
|
||||
|
@ -95,6 +102,7 @@ following additional binds:
|
|||
| [[kbd:][TAB]] | Complete |
|
||||
| [[kbd:][TAB]] | (when completing) Go to next candidate |
|
||||
| [[kbd:][S-TAB]] | (when completing) Go to previous candidate |
|
||||
| [[kbd:][DEL]] | (when completing) Reset completion DWIM-style |
|
||||
|
||||
** Searching with multiple keywords
|
||||
If the [[doom-module::completion corfu +orderless]] flag is enabled, users can
|
||||
|
@ -129,15 +137,18 @@ A few variables may be set to change behavior of this module:
|
|||
Configures behavior for exact matches. Its default is nil, and it's
|
||||
recommended to leave it at that. Otherwise, single matches on snippet keys
|
||||
expand immediately.
|
||||
- [[var:+corfu-buffer-scanning-size-limit]] ::
|
||||
Sets the maximum buffer size to be scanned by ~cape-dabbrev~. Defaults to 1
|
||||
MB. Set this if you are having performance problems using the CAPF.
|
||||
|
||||
** Adding CAPFs to a mode
|
||||
To add other CAPFs on a mode-per-mode basis, put either of the following in your
|
||||
~config.el~:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook! some-mode (add-to-list 'completion-at-point-functions #'some-capf))
|
||||
(add-hook! some-mode (add-hook 'completion-at-point-functions #'some-capf depth t))
|
||||
;; OR, but note the different call signature
|
||||
(add-hook 'some-mode-hook (lambda () (add-to-list 'completion-at-point-functions #'some-capf)))
|
||||
(add-hook 'some-mode-hook (lambda () (add-hook 'completion-at-point-functions #'some-capf depth t)))
|
||||
#+end_src
|
||||
|
||||
~DEPTH~ above is an integer between -100, 100, and defaults to 0 of omitted. Also
|
||||
|
@ -147,6 +158,17 @@ accepts the quoted arguments form above.
|
|||
* Troubleshooting
|
||||
[[doom-report:][Report an issue?]]
|
||||
|
||||
If you have performance issues with ~cape-dabbrev~, the first thing I recommend
|
||||
doing is to look at the list of buffers Dabbrev is scanning:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(dabbrev--select-buffers) ; => (#<buffer README.org> #<buffer config.el<3>> #<buffer cape.el> ...)
|
||||
(length (dabbrev--select-buffers)) ; => 37
|
||||
#+end_src
|
||||
|
||||
... and modify ~dabbrev-ignored-buffer-regexps~ or ~dabbrev-ignored-buffer-modes~
|
||||
accordingly.
|
||||
|
||||
* Frequently asked questions
|
||||
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue