Enable corfu in minibuffer if vertico not active
This commit is contained in:
parent
eb60d4d767
commit
64a7497515
|
@ -513,9 +513,10 @@
|
|||
:ensure t
|
||||
:custom
|
||||
(vertico-cycle t)
|
||||
:init
|
||||
(vertico-mode)
|
||||
:config
|
||||
(require 'vertico-directory)
|
||||
(vertico-mode +1))
|
||||
(require 'vertico-directory))
|
||||
|
||||
(use-package marginalia
|
||||
:ensure t
|
||||
|
@ -538,21 +539,44 @@
|
|||
(corfu-cycle t)
|
||||
(corfu-auto t)
|
||||
(corfu-auto-prefix 3)
|
||||
:config
|
||||
(corfu-quit-no-match 'separator)
|
||||
(corfu-quit-at-boundary 'separator)
|
||||
(corfu-preselect 'directory)
|
||||
:bind (:map corfu-map
|
||||
("RET" . nil))
|
||||
:init
|
||||
(global-corfu-mode +1)
|
||||
:config
|
||||
(when (require 'corfu-popupinfo nil :noerror)
|
||||
(corfu-popupinfo-mode 1)
|
||||
(eldoc-add-command #'corfu-insert)
|
||||
(corfu-popupinfo-mode +1)
|
||||
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
|
||||
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
|
||||
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle))
|
||||
(defun crafted-completion-corfu-eshell ()
|
||||
"Special settings for when using corfu with eshell."
|
||||
(setq-local corfu-quit-at-boundary t
|
||||
corfu-quit-no-match t
|
||||
corfu-auto nil)
|
||||
(corfu-mode))
|
||||
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
|
||||
|
||||
(defun corfu-enable-always-in-minibuffer ()
|
||||
"Enable Corfu in the minibuffer if Vertico is not active."
|
||||
(unless (or (bound-and-true-p vertico--input)
|
||||
(eq (current-local-map) read-passwd-map))
|
||||
(setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
|
||||
corfu-auto nil ;; Enable/disable auto completion
|
||||
corfu-popupinfo-delay nil)
|
||||
(corfu-mode +1)))
|
||||
(add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
|
||||
|
||||
(add-hook 'eshell-mode-hook
|
||||
(lambda ()
|
||||
(setq-local corfu-auto nil)
|
||||
(corfu-mode)))
|
||||
|
||||
(defun corfu-send-shell (&rest _)
|
||||
"Send completion candidate when inside comint/eshell."
|
||||
(cond
|
||||
((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
|
||||
(eshell-send-input))
|
||||
((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input))
|
||||
(comint-send-input))))
|
||||
|
||||
(advice-add #'corfu-insert :after #'corfu-send-shell))
|
||||
|
||||
(use-package cape
|
||||
:ensure t
|
||||
|
|
|
@ -621,9 +621,10 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
|
|||
:ensure t
|
||||
:custom
|
||||
(vertico-cycle t)
|
||||
:init
|
||||
(vertico-mode)
|
||||
:config
|
||||
(require 'vertico-directory)
|
||||
(vertico-mode +1))
|
||||
(require 'vertico-directory))
|
||||
#+end_src
|
||||
|
||||
*** Marginalia
|
||||
|
@ -655,21 +656,44 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
|
|||
(corfu-cycle t)
|
||||
(corfu-auto t)
|
||||
(corfu-auto-prefix 3)
|
||||
:config
|
||||
(corfu-quit-no-match 'separator)
|
||||
(corfu-quit-at-boundary 'separator)
|
||||
(corfu-preselect 'directory)
|
||||
:bind (:map corfu-map
|
||||
("RET" . nil))
|
||||
:init
|
||||
(global-corfu-mode +1)
|
||||
:config
|
||||
(when (require 'corfu-popupinfo nil :noerror)
|
||||
(corfu-popupinfo-mode 1)
|
||||
(eldoc-add-command #'corfu-insert)
|
||||
(corfu-popupinfo-mode +1)
|
||||
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
|
||||
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
|
||||
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle))
|
||||
(defun crafted-completion-corfu-eshell ()
|
||||
"Special settings for when using corfu with eshell."
|
||||
(setq-local corfu-quit-at-boundary t
|
||||
corfu-quit-no-match t
|
||||
corfu-auto nil)
|
||||
(corfu-mode))
|
||||
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
|
||||
|
||||
(defun corfu-enable-always-in-minibuffer ()
|
||||
"Enable Corfu in the minibuffer if Vertico is not active."
|
||||
(unless (or (bound-and-true-p vertico--input)
|
||||
(eq (current-local-map) read-passwd-map))
|
||||
(setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
|
||||
corfu-auto nil ;; Enable/disable auto completion
|
||||
corfu-popupinfo-delay nil)
|
||||
(corfu-mode +1)))
|
||||
(add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
|
||||
|
||||
(add-hook 'eshell-mode-hook
|
||||
(lambda ()
|
||||
(setq-local corfu-auto nil)
|
||||
(corfu-mode)))
|
||||
|
||||
(defun corfu-send-shell (&rest _)
|
||||
"Send completion candidate when inside comint/eshell."
|
||||
(cond
|
||||
((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
|
||||
(eshell-send-input))
|
||||
((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input))
|
||||
(comint-send-input))))
|
||||
|
||||
(advice-add #'corfu-insert :after #'corfu-send-shell))
|
||||
|
||||
(use-package cape
|
||||
:ensure t
|
||||
|
|
Loading…
Reference in a new issue