dev: merging latest changes from pr7002

This commit is contained in:
Matt Nish-Lapidus 2024-01-25 11:16:34 -05:00
commit e840e9274e
3 changed files with 45 additions and 26 deletions

View file

@ -71,29 +71,26 @@ 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) |
| [[kbd:][M-m]] | Export to minibuffer (if [[doom-module::completion vertico]]) |
| [[kbd:][M-j]] | (evil) Export to minibuffer (if [[doom-module::completion vertico]]) |
| [[kbd:][RET]] | Insert candidate |
| [[kbd:][C-RET]] | (in minibuffer) Finish minibuffer without inserting candidate |
| [[kbd:][S-RET]] | (in minibuffer) Finish minibuffer after inserting 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) |
| 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:][C-S-s]] | Export to minibuffer (if [[doom-module::completion vertico]]) |
| [[kbd:][RET]] | Insert candidate |
| [[kbd:][SPC]] | Quit autocompletion or pass-through after a wildcard |
| [[kbd:][C-SPC]] | Complete (unless [[doom-module::completion corfu +tng]]) |
| [[kbd:][C-SPC]] | (when completing) Insert separator DWIM (see below) |
If you prefer a [[kbd:][TAB]]-centric completion style, enable the [[doom-module::completion
corfu +tng]] flag so that, instead, you trigger completion with [[kbd:][TAB]], getting the
@ -106,6 +103,29 @@ following additional binds:
| [[kbd:][S-TAB]] | (when completing) Go to previous candidate |
| [[kbd:][DEL]] | (when completing) Reset completion DWIM-style |
*** Completion in the minibuffer
In the minibuffer, sometimes autocompletion can interfere with your goal;
Imagine you're composing a search pattern incrementally, and you find what you
want early, with only half the word. You then press [[kbd:RET]]. If completion
kicked in as you typed, you may loose the match, since it will complete the
first candidate. On the other hand, if you were paying attention to the
suggestions and selecting one appropriate, that's desired behavior, and you may
even desire to modify the prompt further (if you were composing a command
instead, you may want to extend it after the candidate). To allow better
control, there are 3 confirm bindings when Corfu appears in the minibuffer:
| Keybind | Description |
|-----------+--------------------------------------------------------------------|
| [[kbd:RET]] | Accept the candidate only |
| [[kbd:C-RET]] | Confirm the current prompt only |
| [[kbd:S-RET]] | Accept the candidate then immediately confirm the completed prompt |
- Use [[kbd:RET]] when you want to continue composing after completing;
- Use [[kbd:C-RET]] when you already have the desired string, and completing would
break it;
- Use [[kbd:S-RET]] when you know the composition will be finished after completion
(thus avoiding the need to type [[kbd:RET]] twice);
** Searching with multiple keywords
If the [[doom-module::completion corfu +orderless]] flag is enabled, users can
perform code completion with multiple search keywords by use of space as the

View file

@ -7,8 +7,7 @@
;;; Packages
(use-package! corfu
:defer t
:init
(global-corfu-mode)
:hook (doom-first-buffer-hook . global-corfu-mode)
:config
(setq corfu-auto t
corfu-auto-delay 0.1

View file

@ -458,7 +458,7 @@ Continues comments if executed from a commented line. Consults
(:map corfu-map
[return] #'corfu-insert
"RET" #'corfu-insert
"C-s" #'+corfu-move-to-minibuffer
"C-S-s" #'+corfu-move-to-minibuffer
"C-p" #'corfu-previous
"C-n" #'corfu-next
(:when (modulep! :completion corfu +orderless)