# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+begin_quote
Corfu enhances completion at point with a small completion popup. The current candidates are shown in a popup below or above the point. Corfu is the minimalistic completion-in-region counterpart of the Vertico minibuffer UI.
#+end_quote
#+begin_src emacs-lisp
(use-package corfu
:straight t
:custom
(corfu-separator ?\s) ;; M-SPC
:general
("C-c c" 'completion-at-point)
:init
(global-corfu-mode))
#+end_src
* Company
#+begin_src emacs-lisp :noweb yes :exports none
(use-package company
:defer t
:init
<<company-global-modes>>)
#+end_src
Disable ~company~ globally, because company enables itself...
#+name: company-init
#+begin_src emacs-lisp
(setq company-global-modes nil)
#+end_src
* LSP Mode
#+begin_src emacs-lisp :noweb yes :exports none
(use-package corfu-lsp-mode
:no-require t
:after (lsp-mode corfu)
:init
<<lsp-completion-provider>>)
#+end_src
Make ~lsp-mode~ not turn on ~company~ first thing after start, so annoying.
#+name: lsp-completion-provider
#+begin_src emacs-lisp :tangle no
(setq lsp-completion-provider :none)
#+end_src
* Cape
~cape~ provides useful ~capfs~, such as file and ispell completion, stuff that ~company~ has built-in.
#+begin_src emacs-lisp :noweb yes :exports none
(use-package cape
:straight t
:after (corfu)
:init
<<cape-hooks>>)
#+end_src
Hook ~cape~ onto both ~text-mode~ and ~prog-mode~.