Prelude Corfu
Overview
Corfu is a minimal in-buffer
completion UI for Emacs -- a modern, lightweight alternative to
Company. It uses Emacs' built-in completion-at-point infrastructure
and the standard completion styles (so it cooperates with
orderless from prelude-vertico), instead of providing its own
backend abstraction the way Company does.
Cape extends
completion-at-point-functions with extra sources -- file paths,
dabbrev, keywords, ispell, abbrevs, etc. -- so they show up in the
Corfu popup alongside the language-specific completions provided by
LSP servers, Eglot, etc.
Note
This module is mutually exclusive with the Company module -- enable one or the other, not both.
Packages
Defaults
Corfu auto-pops after typing 2 characters (with a 200 ms debounce) and cycles through candidates with TAB:
| Variable | Value | Effect |
|---|---|---|
corfu-auto |
t |
Open the popup automatically as you type |
corfu-auto-prefix |
2 |
Minimum prefix length to trigger |
corfu-auto-delay |
0.2 |
Delay (seconds) before popup |
corfu-cycle |
t |
Wrap around at end of list |
corfu-popupinfo-mode is enabled by default -- it shows
documentation for the highlighted candidate in a side popup.
Default Cape sources
The following completion-at-point sources are added globally:
cape-dabbrev- completes from words in open bufferscape-file- completes file paths
Add more from your personal config:
(with-eval-after-load 'cape
(add-hook 'completion-at-point-functions #'cape-keyword)
(add-hook 'completion-at-point-functions #'cape-elisp-block))
Tips
- Press M-SPC in the popup to insert a space without dismissing it (useful with orderless).
- M-g opens the candidate at point (e.g. jumps to the function definition); M-h shows its documentation in a separate buffer.
- For language-specific completions to feel snappy, configure your
LSP setup (Eglot or
lsp-mode) to expose richercompletion-at-point-functions-- both already do this out of the box.