feat(config): add smart-ret for corfu
This commit makes RET in Corfu quit auto-completion and passthrough to the underlying keymap if no completion is selected.
This commit is contained in:
parent
d28f217b93
commit
57716ef472
1 changed files with 11 additions and 5 deletions
|
@ -461,8 +461,6 @@ Continues comments if executed from a commented line. Consults
|
||||||
(map! :when (modulep! :completion corfu)
|
(map! :when (modulep! :completion corfu)
|
||||||
:after corfu
|
:after corfu
|
||||||
(:map corfu-map
|
(:map corfu-map
|
||||||
[return] #'corfu-insert
|
|
||||||
"RET" #'corfu-insert
|
|
||||||
"C-S-s" #'+corfu-move-to-minibuffer
|
"C-S-s" #'+corfu-move-to-minibuffer
|
||||||
"C-p" #'corfu-previous
|
"C-p" #'corfu-previous
|
||||||
"C-n" #'corfu-next
|
"C-n" #'corfu-next
|
||||||
|
@ -489,11 +487,19 @@ Continues comments if executed from a commented line. Consults
|
||||||
(when-let ((cmds-del (and (modulep! :completion corfu +tng)
|
(when-let ((cmds-del (and (modulep! :completion corfu +tng)
|
||||||
'(menu-item "Reset completion" corfu-reset
|
'(menu-item "Reset completion" corfu-reset
|
||||||
:enable (and (> corfu--index -1)
|
:enable (and (> corfu--index -1)
|
||||||
(eq corfu-preview-current 'insert))))))
|
(eq corfu-preview-current 'insert)))))
|
||||||
(map! :after corfu
|
(cmds-ret '(menu-item "Insert completion" corfu-insert
|
||||||
|
:filter (lambda (cmd)
|
||||||
|
(if (eq corfu--index -1)
|
||||||
|
(corfu-quit)
|
||||||
|
cmd)))))
|
||||||
|
(map! :when (modulep! :completion corfu)
|
||||||
|
:after corfu
|
||||||
:map corfu-map
|
:map corfu-map
|
||||||
[backspace] cmds-del
|
[backspace] cmds-del
|
||||||
"DEL" cmds-del))
|
"DEL" cmds-del
|
||||||
|
:ig [return] cmds-ret
|
||||||
|
:ig "RET" cmds-ret))
|
||||||
|
|
||||||
;; Smarter C-a/C-e for both Emacs and Evil. C-a will jump to indentation.
|
;; Smarter C-a/C-e for both Emacs and Evil. C-a will jump to indentation.
|
||||||
;; Pressing it again will send you to the true bol. Same goes for C-e, except
|
;; Pressing it again will send you to the true bol. Same goes for C-e, except
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue