Configure corfu

This commit is contained in:
Jeremy Dormitzer 2023-04-20 23:23:50 -04:00
parent 8e904aeed9
commit 9c54aeed6f

View File

@ -5,7 +5,24 @@
;; Corfu-mode provides inline autocompletion
(use-package corfu
:init
(global-corfu-mode))
(global-corfu-mode)
:config
(defun corfu-move-to-minibuffer ()
(interactive)
(when completion-in-region--data
(let ((completion-extra-properties corfu--extra)
completion-cycle-threshold completion-cycling)
(apply #'consult-completion-in-region completion-in-region--data))))
(defun corfu-enable-in-minibuffer ()
"Enable Corfu in the minibuffer if `completion-at-point' is bound."
(when (where-is-internal #'completion-at-point (list (current-local-map)))
(setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
corfu-popupinfo-delay nil)
(corfu-mode 1)))
(add-hook 'minibuffer-setup-hook #'corfu-enable-in-minibuffer)
:general
(corfu-map "S-SPC" #'corfu-insert-separator
"M-m" #'corfu-move-to-minibuffer))
;; Quick file overview for supported modes
(use-package imenu