feat(corfu): impl smart confirm in minibuffer
An issue when using corfu in the minibuffer was the need for pressing RET twice, since the first only inserts the completion. This commit aliviates that by providing C-RET to ignore completion and conclude the minibuffer immediatelly and S-RET to insert completion then conclude.
This commit is contained in:
parent
f5b3531f28
commit
75eef5e9b6
3 changed files with 16 additions and 2 deletions
|
@ -89,6 +89,8 @@ is visible, the following relevant keys are available:
|
||||||
| [[kbd:][M-m]] | Export to minibuffer (if [[doom-module::completion vertico]]) |
|
| [[kbd:][M-m]] | Export to minibuffer (if [[doom-module::completion vertico]]) |
|
||||||
| [[kbd:][M-j]] | (evil) Export to minibuffer (if [[doom-module::completion vertico]]) |
|
| [[kbd:][M-j]] | (evil) Export to minibuffer (if [[doom-module::completion vertico]]) |
|
||||||
| [[kbd:][RET]] | Insert candidate |
|
| [[kbd:][RET]] | Insert candidate |
|
||||||
|
| [[kbd:][C-RET]] | (in minibuffer) Finish minibuffer without inserting candidate |
|
||||||
|
| [[kbd:][S-RET]] | (in minibuffer) Finish minibuffer after inserting candidate |
|
||||||
| [[kbd:][SPC]] | Quit autocompletion after a wildcard or pass-through |
|
| [[kbd:][SPC]] | Quit autocompletion after a wildcard or pass-through |
|
||||||
| [[kbd:][C-SPC]] | Complete (unless [[doom-module::completion corfu +tng]]) |
|
| [[kbd:][C-SPC]] | Complete (unless [[doom-module::completion corfu +tng]]) |
|
||||||
| [[kbd:][C-SPC]] | (when completing) Insert separator DWIM (see below) |
|
| [[kbd:][C-SPC]] | (when completing) Insert separator DWIM (see below) |
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
|
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +corfu-complete-and-exit-minibuffer ()
|
||||||
|
(interactive)
|
||||||
|
(if (>= corfu--index 0)
|
||||||
|
(corfu-complete)
|
||||||
|
(corfu-insert))
|
||||||
|
(exit-minibuffer))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +corfu-move-to-minibuffer ()
|
(defun +corfu-move-to-minibuffer ()
|
||||||
;; Taken from corfu's README.
|
;; Taken from corfu's README.
|
||||||
|
|
|
@ -475,8 +475,12 @@ Continues comments if executed from a commented line. Consults
|
||||||
"C-S-p" #'corfu-popupinfo-scroll-down
|
"C-S-p" #'corfu-popupinfo-scroll-down
|
||||||
"C-S-n" #'corfu-popupinfo-scroll-up
|
"C-S-n" #'corfu-popupinfo-scroll-up
|
||||||
"C-S-u" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-down corfu-popupinfo-min-height))
|
"C-S-u" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-down corfu-popupinfo-min-height))
|
||||||
"C-S-d" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-up corfu-popupinfo-min-height))))
|
"C-S-d" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-up corfu-popupinfo-min-height)))
|
||||||
|
(:map corfu-map
|
||||||
|
:gi "C-<return>" '(menu-item "Conclude the minibuffer" exit-minibuffer
|
||||||
|
:enable (active-minibuffer-window))
|
||||||
|
:gi "S-<return>" '(menu-item "Insert completion and conclude" +corfu-complete-and-exit-minibuffer
|
||||||
|
:enable (active-minibuffer-window))))
|
||||||
(when-let ((cmds-del (and (modulep! :completion corfu +tng)
|
(when-let ((cmds-del (and (modulep! :completion corfu +tng)
|
||||||
(cmds! (and (> corfu--index -1)
|
(cmds! (and (> corfu--index -1)
|
||||||
(eq corfu-preview-current 'insert))
|
(eq corfu-preview-current 'insert))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue