feat(corfu): make minibuffer completion optional
This commit is contained in:
parent
13eba74fe9
commit
2bb5f29a01
1 changed files with 19 additions and 2 deletions
|
@ -6,6 +6,11 @@
|
||||||
(defvar +corfu-want-C-x-bindings t
|
(defvar +corfu-want-C-x-bindings t
|
||||||
"Whether `C-x' is a completion prefix in Evil insert state.")
|
"Whether `C-x' is a completion prefix in Evil insert state.")
|
||||||
|
|
||||||
|
(defvar +corfu-want-minibuffer-completion t
|
||||||
|
"Whether to enable Corfu in the minibuffer.
|
||||||
|
Setting this to `aggressive' will enable Corfu in more commands which
|
||||||
|
use the minibuffer such as `query-replace'.")
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Packages
|
;;; Packages
|
||||||
(use-package! corfu
|
(use-package! corfu
|
||||||
|
@ -13,8 +18,20 @@
|
||||||
:init
|
:init
|
||||||
(add-hook! 'minibuffer-setup-hook
|
(add-hook! 'minibuffer-setup-hook
|
||||||
(defun +corfu-enable-in-minibuffer ()
|
(defun +corfu-enable-in-minibuffer ()
|
||||||
"Enable Corfu in the minibuffer if `completion-at-point' is bound."
|
"Enable Corfu in the minibuffer."
|
||||||
(when (where-is-internal #'completion-at-point (list (current-local-map)))
|
(when (pcase +corfu-want-minibuffer-completion
|
||||||
|
('aggressive
|
||||||
|
(not (or (bound-and-true-p mct--active)
|
||||||
|
(bound-and-true-p vertico--input)
|
||||||
|
(eq (current-local-map) read-passwd-map)
|
||||||
|
(and (featurep 'helm-core) (helm--alive-p))
|
||||||
|
(and (featurep 'ido) (ido-active))
|
||||||
|
(where-is-internal 'minibuffer-complete
|
||||||
|
(list (current-local-map)))
|
||||||
|
(memq #'ivy--queue-exhibit post-command-hook))))
|
||||||
|
('nil nil)
|
||||||
|
(_ (where-is-internal #'completion-at-point
|
||||||
|
(list (current-local-map)))))
|
||||||
(setq-local corfu-echo-delay nil)
|
(setq-local corfu-echo-delay nil)
|
||||||
(corfu-mode +1))))
|
(corfu-mode +1))))
|
||||||
(when (modulep! +orderless)
|
(when (modulep! +orderless)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue