Henrik Lissner 2024-09-01 14:34:06 -04:00
parent 3bced4dbbe
commit 1ec4bac75e
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
6 changed files with 34 additions and 35 deletions

View file

@ -34,26 +34,6 @@ TAB/S-TAB.")
(use-package! corfu
:hook (doom-first-input . global-corfu-mode)
:init
(add-hook! 'minibuffer-setup-hook
(defun +corfu-enable-in-minibuffer ()
"Enable Corfu in the minibuffer."
(when (pcase +corfu-want-minibuffer-completion
('aggressive
(not (or (bound-and-true-p mct--active)
(bound-and-true-p vertico--input)
(and (featurep 'auth-source)
(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)
(corfu-mode +1))))
:config
(setq corfu-auto t
corfu-auto-delay 0.24
@ -80,6 +60,25 @@ TAB/S-TAB.")
(add-to-list 'corfu-continue-commands #'+corfu/smart-sep-toggle-escape)
(add-hook 'evil-insert-state-exit-hook #'corfu-quit)
(defun +corfu-enable-in-minibuffer-p ()
"Return non-nil if Corfu should be enabled in the minibuffer.
See `+corfu-want-minibuffer-completion'."
(pcase +corfu-want-minibuffer-completion
('nil nil)
('aggressive
(not (or (bound-and-true-p mct--active)
(bound-and-true-p vertico--input)
(and (featurep 'auth-source)
(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))))
(_ (where-is-internal #'completion-at-point
(list (current-local-map))))))
(setq global-corfu-minibuffer #'+corfu-enable-in-minibuffer-p)
;; HACK: If you want to update the visual hints after completing minibuffer
;; commands with Corfu and exiting, you have to do it manually.
(defadvice! +corfu--insert-before-exit-minibuffer-a ()

View file

@ -1,8 +1,8 @@
;; -*- no-byte-compile: t; -*-
;;; completion/corfu/packages.el
(package! corfu :pin "cdc3e13ad312f5f12b3f78f842fff0b398eb4473")
(package! cape :pin "f61da109a9e4491614938c300291060fd8855c1b")
(package! corfu :pin "921dd7c97ec41fe8ef81dd5f5a08b0f717586c86")
(package! cape :pin "9110956a5155d5e3c460160fa1b4dac59322c229")
(when (modulep! +icons)
(package! nerd-icons-corfu :pin "7077bb76fefc15aed967476406a19dc5c2500b3c"))
(when (and (not (modulep! :completion vertico))
@ -14,4 +14,4 @@
(when (modulep! :os tty)
(package! corfu-terminal :pin "501548c3d51f926c687e8cd838c5865ec45d03cc"))
(when (modulep! :editor snippets)
(package! yasnippet-capf :pin "744dedb7837d0c7e07817d36ec752a0cd813f55c"))
(package! yasnippet-capf :pin "4c2e33d70cd1d95cf1e08d134b058a6dd90a99c9"))