switched to beta corfu doom package

This commit is contained in:
Matt Nish-Lapidus 2023-09-06 10:06:14 -04:00
parent d54ea39db3
commit 1a4fcfcd0b
6 changed files with 120 additions and 201 deletions

View file

@ -4,9 +4,9 @@
#+since: 3.0.0 (#7002)
* Description :unfold:
This module provides code completion, powered by [[https://github.com/minad/corfu][corfu]].
This module provides code completion, powered by [[doom-package:corfu]].
It is recommended to enable either this or [[doom-module:][:completion company]], in case you
It is recommended to enable either this or [[doom-module::completion company]], in case you
desire pre-configured auto-completion. Corfu is much lighter weight and focused,
plus it's built on native Emacs functionality, whereas company is heavy and
highly non-native, but has some extra features and more maturity.
@ -23,13 +23,18 @@ highly non-native, but has some extra features and more maturity.
Invoke completion on [[kbd:][TAB]]. When corfu is active, [[kbd:][TAB]] and [[kbd:][S-TAB]] will navigate
the completion candidates. Arrow keys and evil-style movement are still
supported.
- +orderless ::
Pull in [[doom-package:orderless]] if necessary and apply multi-component
completion (still needed if [[:completion vertico]] is active).
** Packages
- [[doom-package:][corfu]]
- [[doom-package:][cape]]
- [[doom-package:][kind-icon]] if [[doom-module:][:completion corfu +icons]]
- [[doom-package:][corfu-terminal]] if [[doom-module:][:os tty]]
- [[doom-package:corfu]]
- [[doom-package:cape]]
- [[doom-package:kind-icon]] 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]]
** Hacks
/No hacks documented for this module./
@ -46,7 +51,7 @@ languages may lack code completion support altogether). Run ~$ doom doctor~ to
find out if you're missing any dependencies. Note that corfu may have support
for completions in languages that have no development intelligence, since it
supports generic, context insensitive candidates such as file names or recurring
words.
words. Snippets may also appear in the candidate list if available.
* TODO Usage
#+begin_quote
@ -90,7 +95,7 @@ additional binds:
| [[kbd:][S-TAB]] | (when completing) Go to previous candidate |
** Searching with multiple keywords
If the [[doom-module:][:completion vertico]] module is enabled, users can perform code completion
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
@ -98,48 +103,27 @@ match individually and in any order, with smart casing. Pressing just [[kbd:][SP
as normal and restarts completion, so that when typing sentences it doesn't try
to complete the whole sentence instead of just the word.
Without [[doom-module:][:completion vertico]], it still works, just not as intelligently, due to
the lack of orderless.
** 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 vertico suite allows. For
instance, one could use this to export with [[doom-package:][embark]] via [[kbd:][C-c C-l]] and get a buffer
with all candidates.
** Ispell completion
Ispell completion is supported, so long as you point to the right ~.dic~ file in
~ispell-alternate-dictionary~. For selected text modes (see the configuration
section) it completes everywhere, for programming modes it can complete in
comments and strings.
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
vertico suite allows. For instance, one could use this to export with
[[doom-package:embark]] via [[kbd:][C-c C-l]] and get a buffer with all candidates.
* Configuration
A few variables may be set to change behavior of this module:
- +corfu-auto-delay ::
- [[var:corfu-auto-delay]] ::
Number of seconds till completion occurs automatically. Defaults to 0.1.
- +corfu-auto-prefix ::
- [[var:corfu-auto-prefix]] ::
Number of characters till auto-completion starts to happen. Defaults to 2.
- +corfu-want-multi-component ::
- [[var:+corfu-want-multi-component]] ::
Sets whether orderless-style matching should be supported with space as a
separator.
- +corfu-ispell-completion-modes ::
Lists modes in which to add ~cape-ispell~ as a capf. These show be majorly
text modes, else you will get lots of bad suggestions, since when this matches
it interrupts the flow of candidate selection.
- +corfu-ispell-in-comments-and-strings ::
Whether we should complete when point is inside a string or comment. If
non-nil, works as in a text mode, else gives programming completions just like
in the rest of the buffer.
Additionally, if you prefer to never stop completion on [[kbd:][SPC]], add the following
to your ~config.el~:
#+begin_src emacs-lisp
(map! :map corfu-map
:desc "insert separator" "C-SPC" #'corfu-insert-separator)
#+end_src
- [[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.
* Troubleshooting
[[doom-report:][Report an issue?]]