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