updating config and corfu module

This commit is contained in:
Matt Nish-Lapidus 2023-10-19 11:23:45 -04:00
parent 8bd123ef11
commit b59a7f8cf8
8 changed files with 224 additions and 298 deletions

View file

@ -25,12 +25,12 @@ highly non-native, but has some extra features and more maturity.
supported.
- +orderless ::
Pull in [[doom-package:orderless]] if necessary and apply multi-component
completion (still needed if [[:completion vertico]] is active).
completion (still needed if [[doom-module::completion vertico]] is active).
** Packages
- [[doom-package:corfu]]
- [[doom-package:cape]]
- [[doom-package:kind-icon]] if [[doom-module::completion corfu +icons]]
- [[doom-package:nerd-icons-completion]] if [[doom-module::completion corfu +icons]]
- [[doom-package:orderless]] if [[doom-module::completion corfu +orderless]]
- [[doom-package:corfu-terminal]] if [[doom-module::os tty]]
- [[doom-package:yasnippet-capf]] if [[doom-module::editor snippets]]
@ -78,13 +78,13 @@ is visible, the following relevant keys are available:
| [[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:][s-<down>]] | Export to minibuffer (if [[doom-module:][:completion vertico]]) |
| [[kbd:][s-j]] | (evil) Export to minibuffer (if [[doom-module:][:completion vertico]]) |
| [[kbd:][s-<down>]] | Export to minibuffer (if [[doom-module::completion vertico]]) |
| [[kbd:][s-j]] | (evil) Export to minibuffer (if [[doom-module::completion vertico]]) |
| [[kbd:][RET]] | Insert candidate |
| [[kbd:][C-SPC]] | (when completing) Insert separator (see below) |
| [[kbd:][C-SPC]] | Complete (unless [[doom-module:][:completion corfu +tng]]) |
| [[kbd:][C-SPC]] | Complete (unless [[doom-module::completion corfu +tng]]) |
If you prefer a [[kbd:][TAB]]-centric completion style, enable the [[doom-module:][:completion corfu +tng]]
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 following
additional binds:
@ -95,15 +95,16 @@ additional binds:
| [[kbd:][S-TAB]] | (when completing) Go to previous candidate |
** Searching with multiple keywords
If the ~+orderless~ flag is enabled, users can perform code completion
with multiple search keywords by use of space as separator. More information can
be found [[https://github.com/oantolin/orderless#company][here]]. Pressing [[kdb:][C-SPC]] again while completing inserts a space as
separator. This allows searching with space-separated terms; each piece will
match individually and in any order, with smart casing. Pressing just [[kbd:][SPC]] acts
as normal and restarts completion, so that when typing sentences it doesn't try
to complete the whole sentence instead of just the word.
If the [[doom-module::completion corfu +orderless]] flag is enabled, users can
perform code completion with multiple search keywords by use of space as
separator. More information can be found [[https://github.com/oantolin/orderless#company][here]]. Pressing [[kdb:][C-SPC]] again while
completing inserts a space as separator. This allows searching with
space-separated terms; each piece will match individually and in any order, with
smart casing. Pressing just [[kbd:][SPC]] acts as normal and restarts completion, so that
when typing sentences it doesn't try to complete the whole sentence instead of
just the word.
** Exporting to the minibuffer (requires [[doom-module:][:completion vertico]])
** Exporting to the minibuffer (requires [[doom-module::completion vertico]])
When using the [[doom-module::completion vertico]] module, which pulls in the
[[doom-package:consult]] package, the entries shown in the completion popup can be
exported to a consult minibuffer, giving access to all the manipulations the
@ -117,13 +118,28 @@ A few variables may be set to change behavior of this module:
Number of seconds till completion occurs automatically. Defaults to 0.1.
- [[var:corfu-auto-prefix]] ::
Number of characters till auto-completion starts to happen. Defaults to 2.
- [[var:+corfu-want-multi-component]] ::
Sets whether orderless-style matching should be supported with space as a
separator.
- [[var:corfu-on-exact-match]] ::
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-completion-styles]] ::
Used to override [[var:completion-styles]] for corfu invocations, such that it
can have a value separate from, say, [[doom-package:consult]].
- [[var:+corfu-icon-mapping]] ::
Configures icons used for each completion. See its documentation for details.
** 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))
;; OR, but note the different call signature
(add-hook 'some-mode-hook (lambda () (add-to-list 'completion-at-point-functions #'some-capf)))
#+end_src
Also see ~add-hook!~'s documentation for additional ways to call it.
~add-hook~ only accepts the quoted arguments form above.
* Troubleshooting
[[doom-report:][Report an issue?]]