dotfiles/emacs-lisp/corfu.org
magic_rb cfcb6735b1
emacs: drop the hook on cape-ispell
Signed-off-by: magic_rb <magic_rb@redalder.org>
2023-12-03 20:00:53 +01:00

2.4 KiB

Corfu

#

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.

    (use-package corfu
      :straight t
      :custom
      (corfu-separator ?\s) ;; M-SPC
      :general
      ("C-c c" 'completion-at-point)
      :init
      (global-corfu-mode))

Company

Disable company globally, because company enables itself…

  (setq company-global-modes nil)

LSP Mode

Make lsp-mode not turn on company first thing after start, so annoying.

  (setq lsp-completion-provider :none)

Cape

cape provides useful capfs, such as file and ispell completion, stuff that company has built-in.

Hook cape onto both text-mode and prog-mode.

  (defun cape-setup-capf-prog ()
    "Setup cape completions for prog-mode"
    (cape-setup-capf))

  (defun cape-setup-capf-text ()
    "Setup cape completions for text-mode"
    (cape-setup-capf))

  (defun cape-setup-capf ()
    "Setup cape completions"
    (add-hook 'completion-at-point-functions #'cape-file)
    (add-hook 'completion-at-point-functions #'cape-tex))
  :hook
  ((prog-mode . cape-setup-capf-prog)
   (text-mode . cape-setup-capf-text))

lsp-mode completely wipes completion-at-point-functions, so we need re-add cape after it removes everything.

  (use-package cape-lsp-mode
    :no-require t
    :after (cape lsp-mode)
    :hook
    ((lsp-mode . #'cape-setup-capf)))