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