dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

corfu.info (30425B)


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