README-elpa (29670B)
1 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2 CORFU.EL - COMPLETION OVERLAY REGION FUNCTION 3 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4 5 6 Table of Contents 7 ───────────────── 8 9 1. Features 10 2. Installation and Configuration 11 .. 1. Auto completion 12 .. 2. Completing in the minibuffer 13 .. 3. Completing in the Eshell or Shell 14 .. 4. Orderless completion 15 .. 5. TAB-and-Go completion 16 .. 6. Transfer completion to the minibuffer 17 3. Key bindings 18 4. Extensions 19 5. Complementary packages 20 6. Alternatives 21 7. Contributions 22 23 24 Corfu enhances completion at point with a small completion popup. The 25 current candidates are shown in a popup below or above the point. Corfu 26 is the minimalistic `completion-in-region' counterpart of the [Vertico] 27 minibuffer UI. 28 29 Corfu is a small package, which relies on the Emacs completion 30 facilities and concentrates on providing a polished completion 31 UI. Completions are either provided by commands like 32 `dabbrev-completion' or by pluggable backends 33 (`completion-at-point-functions', Capfs). Most programming language 34 major modes implement a Capf. Furthermore the language server packages, 35 [Eglot] and [Lsp-mode], use Capfs which talk to the LSP server to 36 retrieve the completions. Corfu does not include its own completion 37 backends. The Emacs built-in Capfs and the Capfs provided by other 38 programming language packages are usually sufficient. A few additional 39 Capfs and completion utilities are provided by the [Cape] package. 40 41 *NOTE*: Corfu uses child frames to show the popup and falls back to the 42 default setting of the `completion-in-region-function' on non-graphical 43 displays. If you want to use Corfu in the terminal, install the package 44 [corfu-terminal], which provides an alternative overlay-based display. 45 46 Table of Contents 47 ───────────────── 48 49 1. Features 50 2. Installation and Configuration 51 .. 1. Auto completion 52 .. 2. Completing in the minibuffer 53 .. 3. Completing in the Eshell or Shell 54 .. 4. Orderless completion 55 .. 5. TAB-and-Go completion 56 .. 6. Transfer completion to the minibuffer 57 3. Key bindings 58 4. Extensions 59 5. Complementary packages 60 6. Alternatives 61 7. Contributions 62 63 64 [Vertico] <https://github.com/minad/vertico> 65 66 [Eglot] <https://github.com/joaotavora/eglot> 67 68 [Lsp-mode] <https://github.com/emacs-lsp/lsp-mode> 69 70 [Cape] <https://github.com/minad/cape> 71 72 [corfu-terminal] <https://codeberg.org/akib/emacs-corfu-terminal> 73 74 75 1 Features 76 ══════════ 77 78 • Timer-based auto-completions (/off/ by default, set `corfu-auto'). 79 • Popup display with scrollbar indicator and arrow key navigation. 80 • The popup can be summoned explicitly by pressing `TAB' at any time. 81 • The current candidate is inserted with `TAB' and selected with 82 `RET'. 83 • Candidates sorting by prefix, string length and alphabetically. 84 • The selected candidate is previewed (configurable via 85 `corfu-preview-current'). 86 • The selected candidate automatically committed on further input by 87 default. (configurable via `corfu-preview-current'). 88 • The [Orderless] completion style is supported. The filter string can 89 contain arbitrary characters, after inserting a space via `M-SPC' 90 (configurable via `corfu-quit-at-boundary' and `corfu-separator'). 91 • Deferred completion style highlighting for performance. 92 • Support for candidate annotations and documentation in the echo 93 area. 94 • Deprecated candidates are crossed out in the display. 95 • Icons can be provided by an external package via margin formatter 96 functions. 97 • Extensions: Quick keys, Index keys, Sorting by history, Candidate 98 documentation 99 100 101 [Orderless] <https://github.com/oantolin/orderless> 102 103 104 2 Installation and Configuration 105 ════════════════════════════════ 106 107 Corfu is available from [GNU ELPA], such that it can be installed 108 directly via `package-install'. After installation, the global minor 109 mode can be enabled with `M-x global-corfu-mode'. In order to 110 configure Corfu and other packages in your init.el, you may want to 111 use `use-package'. 112 113 Corfu is highly flexible and customizable via `corfu-*' customization 114 variables, such that you can adapt it precisely to your 115 requirements. However in order to quickly try out the Corfu completion 116 package, it should be sufficient to activate `global-corfu-mode'. You 117 can experiment with manual completion for example in an Elisp buffer 118 or in an Eshell or Shell buffer. For auto completion, set 119 `corfu-auto=t' before turning on `global-corfu-mode'. 120 121 Here is an example configuration: 122 123 ┌──── 124 │ (use-package corfu 125 │ ;; Optional customizations 126 │ ;; :custom 127 │ ;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' 128 │ ;; (corfu-auto t) ;; Enable auto completion 129 │ ;; (corfu-separator ?\s) ;; Orderless field separator 130 │ ;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary 131 │ ;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match 132 │ ;; (corfu-preview-current nil) ;; Disable current candidate preview 133 │ ;; (corfu-preselect-first nil) ;; Disable candidate preselection 134 │ ;; (corfu-on-exact-match nil) ;; Configure handling of exact matches 135 │ ;; (corfu-echo-documentation nil) ;; Disable documentation in the echo area 136 │ ;; (corfu-scroll-margin 5) ;; Use scroll margin 137 │ 138 │ ;; Enable Corfu only for certain modes. 139 │ ;; :hook ((prog-mode . corfu-mode) 140 │ ;; (shell-mode . corfu-mode) 141 │ ;; (eshell-mode . corfu-mode)) 142 │ 143 │ ;; Recommended: Enable Corfu globally. 144 │ ;; This is recommended since Dabbrev can be used globally (M-/). 145 │ ;; See also `corfu-excluded-modes'. 146 │ :init 147 │ (global-corfu-mode)) 148 │ 149 │ ;; A few more useful configurations... 150 │ (use-package emacs 151 │ :init 152 │ ;; TAB cycle if there are only few candidates 153 │ (setq completion-cycle-threshold 3) 154 │ 155 │ ;; Emacs 28: Hide commands in M-x which do not apply to the current mode. 156 │ ;; Corfu commands are hidden, since they are not supposed to be used via M-x. 157 │ ;; (setq read-extended-command-predicate 158 │ ;; #'command-completion-default-include-p) 159 │ 160 │ ;; Enable indentation+completion using the TAB key. 161 │ ;; `completion-at-point' is often bound to M-TAB. 162 │ (setq tab-always-indent 'complete)) 163 └──── 164 165 Dabbrev completion is based on `completion-in-region' and can be used 166 with Corfu. You may want to swap the `dabbrev-completion' with the 167 `dabbrev-expand' key for easier access, if you prefer completion. Also 168 take a look at the `cape-dabbrev' completion at point function 169 provided by my [Cape] package. 170 171 ┌──── 172 │ ;; Use Dabbrev with Corfu! 173 │ (use-package dabbrev 174 │ ;; Swap M-/ and C-M-/ 175 │ :bind (("M-/" . dabbrev-completion) 176 │ ("C-M-/" . dabbrev-expand)) 177 │ ;; Other useful Dabbrev configurations. 178 │ :custom 179 │ (dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))) 180 └──── 181 182 If you start to configure the package more deeply, I recommend to give 183 the Orderless completion style a try for filtering. Orderless 184 completion is different from the familiar prefix TAB completion. Corfu 185 can be used with the default completion styles. The use of Orderless 186 is not a necessity. 187 188 ┌──── 189 │ ;; Optionally use the `orderless' completion style. 190 │ (use-package orderless 191 │ :init 192 │ ;; Configure a custom style dispatcher (see the Consult wiki) 193 │ ;; (setq orderless-style-dispatchers '(+orderless-dispatch) 194 │ ;; orderless-component-separator #'orderless-escapable-split-on-space) 195 │ (setq completion-styles '(orderless basic) 196 │ completion-category-defaults nil 197 │ completion-category-overrides '((file (styles . (partial-completion)))))) 198 └──── 199 200 The `basic' completion style is specified as fallback in addition to 201 `orderless' in order to ensure that completion commands which rely on 202 dynamic completion tables, e.g., `completion-table-dynamic' or 203 `completion-table-in-turn', work correctly. See `+orderless-dispatch' 204 in the [Consult wiki] for an advanced Orderless style 205 dispatcher. Additionally enable `partial-completion' for file path 206 expansion. `partial-completion' is important for file wildcard 207 support. Multiple files can be opened at once with `find-file' if you 208 enter a wildcard. You may also give the `initials' completion style a 209 try. 210 211 See also the [Corfu Wiki] and the [Cape manual] for additional Capf 212 configuration tips. The Lsp-mode configuration is documented in the 213 wiki. For more general documentation read the chapter about completion 214 in the [Emacs manual]. If you want to create your own Capfs, you can 215 find documentation about completion in the [Elisp manual]. 216 217 218 [GNU ELPA] <http://elpa.gnu.org/packages/corfu.html> 219 220 [Cape] <https://github.com/minad/cape> 221 222 [Consult wiki] <https://github.com/minad/consult/wiki> 223 224 [Corfu Wiki] <https://github.com/minad/corfu/wiki> 225 226 [Cape manual] <https://github.com/minad/cape> 227 228 [Emacs manual] 229 <https://www.gnu.org/software/emacs/manual/html_node/emacs/Completion.html> 230 231 [Elisp manual] 232 <https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion.html> 233 234 2.1 Auto completion 235 ─────────────────── 236 237 Auto completion is disabled by default, but can be enabled by setting 238 `corfu-auto=t'. Furthermore you may want to configure Corfu to quit 239 completion eagerly, such that the completion popup stays out of your 240 way when it appeared unexpectedly. 241 242 ┌──── 243 │ ;; Enable auto completion and configure quitting 244 │ (setq corfu-auto t 245 │ corfu-quit-no-match 'separator) ;; or t 246 └──── 247 248 I recommend to experiment a bit with the various settings and key 249 bindings to find a configuration which works for you. There is no one 250 size fits all solution. Some people like auto completion, some like 251 manual completion, some want to cycle with TAB and some with the arrow 252 keys. 253 254 In case you like aggressive auto completion settings, where the 255 completion popup appears immediately, I recommend to use a cheap 256 completion style like `basic', which performs prefix filtering. In 257 this case Corfu completion should still be very fast in buffers with 258 efficient completion backends. You can try the following settings in 259 an Elisp buffer or the Emacs scratch buffer. 260 261 ┌──── 262 │ ;; Aggressive completion, cheap prefix filtering. 263 │ (setq-local corfu-auto t 264 │ corfu-auto-delay 0 265 │ corfu-auto-prefix 0 266 │ completion-styles '(basic)) 267 └──── 268 269 If you want to combine fast prefix filtering and Orderless filtering 270 you can still do that by defining a custom Orderless completion style 271 via `orderless-define-completion-style'. We use a custom style 272 dispatcher, which enables prefix filtering for input shorter than 4 273 characters. Note that such a setup is quite advanced. Please refer to 274 the Orderless documentation and source code for further details. 275 276 ┌──── 277 │ (defun orderless-fast-dispatch (word index total) 278 │ (and (= index 0) (= total 1) (length< word 4) 279 │ `(orderless-regexp . ,(concat "^" (regexp-quote word))))) 280 │ 281 │ (orderless-define-completion-style orderless-fast 282 │ (orderless-style-dispatchers '(orderless-fast-dispatch)) 283 │ (orderless-matching-styles '(orderless-literal orderless-regexp))) 284 │ 285 │ (setq-local corfu-auto t 286 │ corfu-auto-delay 0 287 │ corfu-auto-prefix 0 288 │ completion-styles '(orderless-fast)) 289 └──── 290 291 292 2.2 Completing in the minibuffer 293 ──────────────────────────────── 294 295 Corfu can be used for completion in the minibuffer, since it relies on 296 child frames to display the candidates. By default, 297 `global-corfu-mode' does not activate `corfu-mode' in the minibuffer, 298 to avoid interference with specialised minibuffer completion UIs like 299 Vertico or Mct. However you may still want to enable Corfu completion 300 for commands like `M-:' (`eval-expression') or `M-!' 301 (`shell-command'), which read from the minibuffer. Activate 302 `corfu-mode' only if `completion-at-point' is bound in the 303 minibuffer-local keymap to achieve this effect. 304 305 ┌──── 306 │ (defun corfu-enable-in-minibuffer () 307 │ "Enable Corfu in the minibuffer if `completion-at-point' is bound." 308 │ (when (where-is-internal #'completion-at-point (list (current-local-map))) 309 │ ;; (setq-local corfu-auto nil) Enable/disable auto completion 310 │ (corfu-mode 1))) 311 │ (add-hook 'minibuffer-setup-hook #'corfu-enable-in-minibuffer) 312 └──── 313 314 You can also enable Corfu more generally for every minibuffer, as long 315 as no other completion UI is active. If you use Mct or Vertico as your 316 main minibuffer completion UI, the following snippet should yield the 317 desired result. 318 319 ┌──── 320 │ (defun corfu-enable-always-in-minibuffer () 321 │ "Enable Corfu in the minibuffer if Vertico/Mct are not active." 322 │ (unless (or (bound-and-true-p mct--active) 323 │ (bound-and-true-p vertico--input)) 324 │ ;; (setq-local corfu-auto nil) Enable/disable auto completion 325 │ (corfu-mode 1))) 326 │ (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1) 327 └──── 328 329 330 2.3 Completing in the Eshell or Shell 331 ───────────────────────────────────── 332 333 When completing in the Eshell I recommend conservative local settings 334 without auto completion, such that the completion behavior is similar 335 to widely used shells like Bash, Zsh or Fish. 336 337 ┌──── 338 │ (add-hook 'eshell-mode-hook 339 │ (lambda () 340 │ (setq-local corfu-auto nil) 341 │ (corfu-mode))) 342 └──── 343 344 When pressing `RET' while the Corfu popup is visible, the 345 `corfu-insert' command will be invoked. This command does inserts the 346 currently selected candidate, but it does not send the prompt input to 347 Eshell or the comint process. Therefore you often have to press `RET' 348 twice which feels like an unnecessary double confirmation. Fortunately 349 it is easy to improve this! In my configuration I define the advice 350 `corfu-send-shell' which sends the candidate after insertion. 351 352 ┌──── 353 │ (defun corfu-send-shell (&rest _) 354 │ "Send completion candidate when inside comint/eshell." 355 │ (cond 356 │ ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input)) 357 │ (eshell-send-input)) 358 │ ((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input)) 359 │ (comint-send-input)))) 360 │ 361 │ (advice-add #'corfu-insert :after #'corfu-send-shell) 362 └──── 363 364 Shell completion uses the flexible `Pcomplete' mechanism internally, 365 which allows you to program the completions per shell command. If you 366 want to know more, look into this [blog post], which shows how to 367 configure Pcomplete for git commands. I recommend the [pcmpl-args] 368 package which extends Pcomplete with completion support and helpful 369 annotation support for more commands. Similar to the Fish shell, 370 pcmpl-args uses man page parsing and –help output parsing to 371 dynamically generate completions. This package brings Eshell 372 completion to another level! 373 374 Unfortunately Pcomplete has a few technical issues, which we can work 375 around with the [Cape] library (Completion at point extensions). Cape 376 provides wrappers, which sanitize the Pcomplete function. Ideally the 377 bugs in Pcomplete should be fixed upstream. *For now these two advices 378 are strongly recommended to achieve a sane Eshell experience.* 379 380 ┌──── 381 │ ;; Silence the pcomplete capf, no errors or messages! 382 │ (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent) 383 │ 384 │ ;; Ensure that pcomplete does not write to the buffer 385 │ ;; and behaves as a pure `completion-at-point-function'. 386 │ (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify) 387 └──── 388 389 390 [blog post] 391 <https://www.masteringemacs.org/article/pcomplete-context-sensitive-completion-emacs> 392 393 [pcmpl-args] <https://github.com/JonWaltman/pcmpl-args.el> 394 395 [Cape] <https://github.com/minad/cape> 396 397 398 2.4 Orderless completion 399 ──────────────────────── 400 401 [Orderless] is an advanced completion style that supports 402 multi-component search filters separated by a configurable character 403 (space, by default). Normally, entering characters like space which 404 lie outside the completion region boundaries (words, typically) causes 405 Corfu to quit. This behavior is helpful with auto-completion, which 406 may pop-up when not desired, e.g. on entering a new variable 407 name. Just keep typing and Corfu will get out of the way. 408 409 But orderless search terms can contain arbitrary characters; they are 410 also interpreted as regular expressions. To use orderless, set 411 `corfu-separator' (a space, by default) to the primary character of 412 your orderless component separator. 413 414 Then, when a new orderless component is desired, use `M-SPC' 415 (`corfu-insert-separator') to enter the /first/ component separator in 416 the input, and arbitrary orderless search terms and new separators can 417 be entered thereafter. 418 419 To treat the entire input as Orderless input, you can set the 420 customization option `corfu-quit-at-boundary=t'. This disables the 421 predicate which checks if the current completion boundary has been 422 left. In contrast, if you /always/ want to quit at the boundary, 423 simply set `corfu-quit-at-boundary=nil'. By default 424 `corfu-quit-at-boundary' is set to `separator' which quits at 425 completion boundaries as long as no separator has been inserted with 426 `corfu-insert-separator'. 427 428 Finally, there exists the user option `corfu-quit-no-match' which is 429 set to `separator' by default. With this setting Corfu stays alive as 430 soon as you start advanced filtering with a `corfu-separator' even if 431 there are no matches, for example due to a typo. As long as no 432 separator character has been inserted with `corfu-insert-separator', 433 Corfu will still quit if there are no matches. This ensures that the 434 Corfu popup goes away quickly if completion is not possible. 435 436 In the following we show two configurations, one which works best with 437 auto completion and one which may work better with manual completion 438 if you prefer to always use `SPC' to separate the Orderless 439 components. 440 441 ┌──── 442 │ ;; Auto completion example 443 │ (use-package corfu 444 │ :custom 445 │ (corfu-auto t) ;; Enable auto completion 446 │ ;; (corfu-separator ?_) ;; Set to orderless separator, if not using space 447 │ :bind 448 │ ;; Another key binding can be used, such as S-SPC. 449 │ ;; (:map corfu-map ("M-SPC" . corfu-insert-separator)) 450 │ :init 451 │ (global-corfu-mode)) 452 │ 453 │ ;; Manual completion example 454 │ (use-package corfu 455 │ :custom 456 │ ;; (corfu-separator ?_) ;; Set to orderless separator, if not using space 457 │ :bind 458 │ ;; Configure SPC for separator insertion 459 │ (:map corfu-map ("SPC" . corfu-insert-separator)) 460 │ :init 461 │ (global-corfu-mode)) 462 └──── 463 464 465 [Orderless] <https://github.com/oantolin/orderless> 466 467 468 2.5 TAB-and-Go completion 469 ───────────────────────── 470 471 You may be interested in configuring Corfu in TAB-and-Go 472 style. Pressing TAB moves to the next candidate and further input will 473 then commit the selection. Note that further input will not expand 474 snippets or templates, which may not be desired but which leads 475 overall to a more predictable behavior. In order to force snippet 476 expansion, confirm a candidate explicitly with `RET'. 477 478 ┌──── 479 │ (use-package corfu 480 │ ;; TAB-and-Go customizations 481 │ :custom 482 │ (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' 483 │ (corfu-preselect-first nil) ;; Disable candidate preselection 484 │ 485 │ ;; Use TAB for cycling, default is `corfu-complete'. 486 │ :bind 487 │ (:map corfu-map 488 │ ("TAB" . corfu-next) 489 │ ([tab] . corfu-next) 490 │ ("S-TAB" . corfu-previous) 491 │ ([backtab] . corfu-previous)) 492 │ 493 │ :init 494 │ (global-corfu-mode)) 495 └──── 496 497 498 2.6 Transfer completion to the minibuffer 499 ───────────────────────────────────────── 500 501 Sometimes it is useful to transfer the Corfu completion session to the 502 minibuffer, since the minibuffer offers richer interaction 503 features. In particular, [Embark] is available in the minibuffer, such 504 that you can act on the candidates or export/collect the candidates to 505 a separate buffer. Hopefully we can also add Corfu-support to Embark 506 in the future, such that at least export/collect is possible directly 507 from Corfu. But in my opinion having the ability to transfer the Corfu 508 completion to the minibuffer is an even better feature, since further 509 completion can be performed there. 510 511 The command `corfu-move-to-minibuffer' is defined here in terms of 512 `consult-completion-in-region', which uses the minibuffer completion 513 UI via `completing-read'. 514 515 ┌──── 516 │ (defun corfu-move-to-minibuffer () 517 │ (interactive) 518 │ (let ((completion-extra-properties corfu--extra) 519 │ completion-cycle-threshold completion-cycling) 520 │ (apply #'consult-completion-in-region completion-in-region--data))) 521 │ (define-key corfu-map "\M-m" #'corfu-move-to-minibuffer) 522 └──── 523 524 525 [Embark] <https://github.com/oantolin/embark> 526 527 528 3 Key bindings 529 ══════════════ 530 531 Corfu uses a transient keymap `corfu-map' which is active while the 532 popup is shown. The keymap defines the following remappings and 533 bindings: 534 535 • `beginning-of-buffer' -> `corfu-first' 536 • `end-of-buffer' -> `corfu-last' 537 • `scroll-down-command' -> `corfu-scroll-down' 538 • `scroll-up-command' -> `corfu-scroll-up' 539 • `next-line', `down', `M-n' -> `corfu-next' 540 • `previous-line', `up', `M-p' -> `corfu-previous' 541 • `completion-at-point', `TAB' -> `corfu-complete' 542 • `RET' -> `corfu-insert' 543 • `M-g' -> `corfu-info-location' 544 • `M-h' -> `corfu-info-documentation' 545 • `M-SPC' -> `corfu-insert-separator' 546 • `C-g' -> `corfu-quit' 547 • `keyboard-escape-quit' -> `corfu-reset' 548 549 550 4 Extensions 551 ════════════ 552 553 We maintain small extension packages to Corfu in this repository in 554 the subdirectory [extensions/]. The extensions are installed together 555 with Corfu if you pull the package from ELPA. The extensions are 556 inactive by default and can be enabled manually if 557 desired. Furthermore it is possible to install all of the files 558 separately, both `corfu.el' and the `corfu-*.el' extensions. Currently 559 the following extensions come with the Corfu ELPA package: 560 561 • [corfu-history]: `corfu-history-mode' to remember selected 562 candidates and to improve sorting. 563 • [corfu-indexed]: `corfu-indexed-mode' to select indexed candidates 564 with prefix arguments. 565 • [corfu-info]: Actions to access the candidate location and 566 documentation. 567 • [corfu-quick]: Commands to select using Avy-style quick keys. 568 569 See the Commentary of those files for configuration details. 570 571 572 [extensions/] <https://github.com/minad/corfu/tree/main/extensions> 573 574 [corfu-history] 575 <https://github.com/minad/corfu/blob/main/extensions/corfu-history.el> 576 577 [corfu-indexed] 578 <https://github.com/minad/corfu/blob/main/extensions/corfu-indexed.el> 579 580 [corfu-info] 581 <https://github.com/minad/corfu/blob/main/extensions/corfu-info.el> 582 583 [corfu-quick] 584 <https://github.com/minad/corfu/blob/main/extensions/corfu-quick.el> 585 586 587 5 Complementary packages 588 ════════════════════════ 589 590 Corfu works well together with all packages providing code completion 591 via the `completion-at-point-functions'. Many modes and packages 592 already provide a Capf out of the box. Nevertheless you may want to 593 look into complementary packages to enhance your setup. 594 595 • [corfu-terminal]: The corfu-terminal package provides an 596 overlay-based display for Corfu, such that you can use Corfu in 597 terminal Emacs. 598 599 • [corfu-doc]: The corfu-doc package displays the candidate 600 documentation in a popup next to the Corfu popup, similar to 601 `company-quickhelp'. 602 603 • [Orderless]: Corfu supports completion styles, including the 604 advanced [Orderless] completion style, where the filtering 605 expressions are separated by spaces or another character (see 606 `corfu-separator'). 607 608 • [Cape]: Additional Capf backends and `completion-in-region' commands 609 are provided by the [Cape] package. Among others, the package 610 supplies a file path and a Dabbrev completion backend. Cape provides 611 the `cape-company-to-capf' adapter to reuse Company backends in 612 Corfu. Furthermore the function `cape-super-capf' can merge multiple 613 Capfs, such that the candidates of multiple Capfs are displayed 614 together at the same time. 615 616 • [kind-icon]: Icons are supported by Corfu via an external 617 package. For example the [kind-icon] package provides beautifully 618 styled SVG icons based on monochromatic icon sets like material 619 design. 620 621 • [pcmpl-args]: Extend the Eshell/Shell Pcomplete mechanism with 622 support for many more commands. Similar to the Fish shell, Pcomplete 623 uses man page parsing to dynamically retrieve the completions and 624 helpful annotations. This package brings Eshell completions to 625 another level! 626 627 • [Tempel]: Tiny template/snippet package with templates in Lisp 628 syntax, which can be used in conjunction with Corfu. 629 630 • [Vertico]: You may also want to look into my [Vertico] 631 package. Vertico is the minibuffer completion counterpart of Corfu. 632 633 634 [corfu-terminal] <https://codeberg.org/akib/emacs-corfu-terminal> 635 636 [corfu-doc] <https://github.com/galeo/corfu-doc> 637 638 [Orderless] <https://github.com/oantolin/orderless> 639 640 [Cape] <https://github.com/minad/cape> 641 642 [kind-icon] <https://github.com/jdtsmith/kind-icon> 643 644 [pcmpl-args] <https://github.com/JonWaltman/pcmpl-args.el> 645 646 [Tempel] <https://github.com/minad/tempel> 647 648 [Vertico] <https://github.com/minad/vertico> 649 650 651 6 Alternatives 652 ══════════════ 653 654 • [Company]: Company is a widely used and mature completion package, 655 which implements a similar interaction model and popup UI as 656 Corfu. While Corfu relies exclusively on the standard Emacs 657 completion API (Capfs), Company defines its own API for the 658 backends. Company includes its completion backends, which are 659 incompatible with the Emacs completion infrastructure. As a result 660 of this design, Company is a more complex package than 661 Corfu. Company by default uses overlays for the popup in contrast to 662 the child frames used by Corfu. Overall both packages work well, but 663 Company integrates less tightly with Emacs. The `completion-styles' 664 support is more limited and the `completion-at-point' command and 665 the `completion-in-region' function do not invoke Company. 666 667 • [Mct]: Protesilaos' Minibuffer Confines Transcended package supports 668 both minibuffer completion and completion in region. It reuses the 669 default completion UI for this purpose and installs a timer which 670 live updates the completion buffer. The main advantage of Mct is 671 that you work with a regular Emacs buffer instead of with a 672 popup. You can take advantage of the usual Emacs commands to 673 navigate in the completions buffer. On top, Mct enhances the 674 movement such that you can quickly switch between the completions 675 buffer and the minibuffer or the region which is being 676 completed. Mct does not support timer-based auto completion, but the 677 integration into Emacs is naturally tight. Note that Mct development 678 is currently [discontinued] due to recent changes of the default 679 completion UI on the Emacs master branch. 680 681 • [consult-completion-in-region]: The Consult package provides the 682 function `consult-completion-in-region' which can be set as 683 `completion-in-region-function' such that it handles 684 `completion-at-point'. The function works by transferring the 685 in-buffer completion to the minibuffer. In the minibuffer, the 686 minibuffer completion UI, for example [Vertico] takes over. If you 687 prefer to perform all your completions in the minibuffer 688 `consult-completion-in-region' is your best option. 689 690 691 [Company] <https://github.com/company-mode/company-mode> 692 693 [Mct] <https://git.sr.ht/~protesilaos/mct> 694 695 [discontinued] 696 <https://protesilaos.com/codelog/2022-04-14-emacs-discontinue-mct/> 697 698 [consult-completion-in-region] <https://github.com/minad/consult> 699 700 [Vertico] <https://github.com/minad/vertico> 701 702 703 7 Contributions 704 ═══════════════ 705 706 Since this package is part of [GNU ELPA] contributions require a 707 copyright assignment to the FSF. 708 709 710 [GNU ELPA] <http://elpa.gnu.org/packages/corfu.html>