commit f411d9bb9f650f462b7f432ab96ad72cdcf8084e parent 359abab737d633fad5b7904b6c877bd2989aaf6b Author: Vincent Demeester <vincent@sbr.pm> Date: Wed, 15 Nov 2023 22:34:05 +0100 tools/emacs: configure corfu Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/config/config-completion.el | | | 21 | +++++++++++++++++++++ |
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/config/config-completion.el b/tools/emacs/config/config-completion.el @@ -94,5 +94,26 @@ :unless noninteractive :config (marginalia-mode 1)) + +(use-package corfu + :unless noninteractive + :config + (global-corfu-mode 1) + (corfu-popupinfo-mode 1) + ;; Sort by input history (no need to modify `corfu-sort-function'). + (with-eval-after-load 'savehist + (corfu-history-mode 1) + (add-to-list 'savehist-additional-variables 'corfu-history)) + + ;; Adapted from Corfu's manual. + (defun contrib/corfu-enable-always-in-minibuffer () + "Enable Corfu in the minibuffer if MCT or Vertico is not active. +Useful for prompts such as `eval-expression' and `shell-command'." + (unless (or (bound-and-true-p vertico--input) + (bound-and-true-p mct--active)) + (corfu-mode 1))) + + (add-hook 'minibuffer-setup-hook #'contrib/corfu-enable-always-in-minibuffer 1)) + (provide 'config-completion) ;;; config-completion.el ends here