feat(corfu): make minibuffer completion optional
This commit is contained in:
parent
763464afdb
commit
4192c81113
2 changed files with 22 additions and 2 deletions
|
@ -198,6 +198,9 @@ A few variables may be set to change behavior of this module:
|
||||||
- [[var:+corfu-buffer-scanning-size-limit]] ::
|
- [[var:+corfu-buffer-scanning-size-limit]] ::
|
||||||
Sets the maximum buffer size to be scanned by ~cape-dabbrev~. Defaults to 1 MB.
|
Sets the maximum buffer size to be scanned by ~cape-dabbrev~. Defaults to 1 MB.
|
||||||
Set this if you are having performance problems using the CAPF.
|
Set this if you are having performance problems using the CAPF.
|
||||||
|
- [[var:+corfu-want-minibuffer-completion]] ::
|
||||||
|
Whether to enable Corfu in the minibuffer. See its documentation for
|
||||||
|
additional tweaks.
|
||||||
|
|
||||||
** Adding CAPFs to a mode
|
** Adding CAPFs to a mode
|
||||||
To add other CAPFs on a mode-per-mode basis, put either of the following in your
|
To add other CAPFs on a mode-per-mode basis, put either of the following in your
|
||||||
|
|
|
@ -11,6 +11,11 @@ Possible values are:
|
||||||
(defvar +corfu-buffer-scanning-size-limit (* 1 1024 1024) ; 1 MB
|
(defvar +corfu-buffer-scanning-size-limit (* 1 1024 1024) ; 1 MB
|
||||||
"Size limit for a buffer to be scanned by `cape-dabbrev'.")
|
"Size limit for a buffer to be scanned by `cape-dabbrev'.")
|
||||||
|
|
||||||
|
(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
|
||||||
|
@ -18,8 +23,20 @@ Possible values are:
|
||||||
: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))))
|
||||||
:config
|
:config
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue