This is corfu.info, produced by makeinfo version 6.5 from corfu.texi.

INFO-DIR-SECTION Emacs
START-INFO-DIR-ENTRY
* Corfu: (corfu).       Completion Overlay Region FUnction.
END-INFO-DIR-ENTRY


File: corfu.info,  Node: Top,  Next: Introduction,  Up: (dir)

corfu.el - Completion Overlay Region FUnction
*********************************************

* Menu:

* Introduction::
* Features::
* Configuration::
* Complementary packages::
* Caveats::
* Contributions::


File: corfu.info,  Node: Introduction,  Next: Features,  Prev: Top,  Up: Top

1 Introduction
**************

Corfu provides a completion overlay for the default completion in region
function.  The current candidates are shown in a popup overlay below or
above the point.  Corfu can be considered the minimalistic
completion-in-region counterpart of Vertico.

   Icomplete provides both completion-in-region and minibuffer
completion in a single package.  While Corfu and Vertico are technically
similar to Icomplete, Corfu and Vertico are two separate packages in
order to optimize the UI for the two distinct use cases, also leading to
code bases which are easier to understand.

   Corfu is a minimal package of less than 500 lines of code (my
arbitrary limit for small components providing a single specific
feature).  In contrast to the featureful and complex Company package,
Corfu only provides the completion UI. No custom backends are provided.
The completions are provided by the ‘completion-at-point-functions’.
However many code completion backends provide
‘completion-at-point-functions’, such that relying only on the default
completion may often be sufficient.

   <https://github.com/minad/corfu/blob/main/screenshot.png?raw=true>


File: corfu.info,  Node: Features,  Next: Configuration,  Prev: Introduction,  Up: Top

2 Features
**********

   • Popup display with scrollbar indicator and arrow key navigation
   • The popup must be summoned explicitly by ‘TAB’
   • The current candidate is inserted with ‘TAB’ and selected with
     ‘RET’
   • Candidates sorting by prefix, string length and alphabetically
   • Completion is automatically terminated after candidate selection
   • Filter string can contain arbitrary characters and spaces (needed
     when filtering with the Orderless
     (https://github.com/oantolin/orderless) completion style)
   • Deferred completion style highlighting for performance
   • Jumping to location/documentation of current candidate (Company
     extension)
   • Support for ‘annotation-function’ and ‘affixation-function’

   Notable non-feature: Timer-based automatic completions are not
supported.


File: corfu.info,  Node: Configuration,  Next: Complementary packages,  Prev: Features,  Up: Top

3 Configuration
***************

Corfu is available from GNU ELPA
(http://elpa.gnu.org/packages/corfu.html), such that it can be installed
directly via ‘package-install’.  After installation, the local minor
mode can be enabled with ‘M-x corfu-mode’.  In order to configure Corfu
and other packages in your init.el, you may want to use ‘use-package’.
I recommend to give orderless completion a try, which is different from
the familiar prefix TAB completion.  Here is an example configuration:

     ;; Configure corfu
     (use-package corfu
       ;; Optionally use TAB for cycling, default is `corfu-complete'.
       ;; :bind (:map corfu-map
       ;;        ("TAB" . corfu-next)
       ;;        ("S-TAB" . corfu-previous))

       ;; Enable the overlay only for certain modes.
       ;; For example it is not a useful UI for completions at point in the
       ;; minibuffer.
       :hook ((prog-mode . corfu-mode)
              (eshell-mode . corfu-mode))

       :config

       ;; Optionally enable cycling for `corfu-next' and `corfu-previous'.
       ;; (setq corfu-cycle t)
     )

     ;; Use the `orderless' completion style.
     ;; Enable `partial-completion' for files to allow path expansion.
     ;; You may prefer to use `initials' instead of `partial-completion'.
     (use-package orderless
       :init
       (setq completion-styles '(orderless)
             completion-category-defaults nil
             completion-category-overrides '((file (styles . (partial-completion))))))

     ;; A few more useful configurations...
     (use-package emacs
       :init
       ;; TAB cycle if there are only few candidates
       (setq completion-cycle-threshold 3)

       ;; Enable indentation+completion using the TAB key.
       ;; Completion is often bound to M-TAB.
       (setq tab-always-indent 'complete))


File: corfu.info,  Node: Complementary packages,  Next: Caveats,  Prev: Configuration,  Up: Top

4 Complementary packages
************************

Corfu works well together with all packages providing code completion
via the ‘completion-at-point-functions’.  Furthermore it supports
various completion styles, including the advanced Orderless
(https://github.com/oantolin/orderless) completion style, where the
filtering expressions are separated by spaces.

   You may also want to look into my Vertico
(https://github.com/minad/vertico) package, which provides a vertical
minibuffer completion system.  Vertico is the minibuffer counterpart of
Corfu.


File: corfu.info,  Node: Caveats,  Next: Contributions,  Prev: Complementary packages,  Up: Top

5 Caveats
*********

This package is experimental and new.  I am not yet claiming that this
package works correctly.  There are a few known caveats.

   • No caching, the completion table is called directly.
   • The ‘:exit-function’ handling is probably insufficient.
   • The overlay popup is brittle (Alternatives: Posframe, Postip?)
   • The thin popup borders are only drawn if ‘line-spacing=nil’.
   • The abort handling could be improved.  Undo the completion input?
   • The ‘completion-in-region-mode-predicate’ is deliberatly ignored in
     order to give the completion style full control.  This predicate
     checks if the start position of the completion changed by calling
     the backend.
   • Completion is terminated if there are no matches.  Add optional
     confirmation?
   • Company kind icons are not supported (‘company-kind’)
   • Company metadata is not shown (‘company-docsig’)


File: corfu.info,  Node: Contributions,  Prev: Caveats,  Up: Top

6 Contributions
***************

Since this package is part of GNU ELPA, contributions require copyright
assignment to the FSF.



Tag Table:
Node: Top195
Node: Introduction468
Node: Features1725
Node: Configuration2676
Node: Complementary packages4618
Node: Caveats5279
Node: Contributions6324

End Tag Table


Local Variables:
coding: utf-8
End:
