diff options
-rw-r--r-- | completion.org | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/completion.org b/completion.org index 38b1eab..d07472c 100644 --- a/completion.org +++ b/completion.org @@ -171,17 +171,26 @@ (add-hook ',hook-name #'jao-corfu-enable-no-auto)))) (jao-corfu-no-auto eshell) - (add-to-list 'corfu-excluded-modes 'notmuch-message-mode) + ;; (add-to-list 'corfu-excluded-modes 'notmuch-message-mode) + + (defun jao-corfu--active-p () + (and (>= corfu--index 0) (/= corfu--index corfu--preselect))) (defun jao-corfu-quit-or-insert () (interactive) - (if (and (>= corfu--index 0) (/= corfu--index corfu--preselect)) - (corfu-insert) - (corfu-quit))) + (if (jao-corfu--active-p) (corfu-insert) (corfu-quit))) + + (defun jao-corfu-quit-or-previous () + (interactive) + (if (jao-corfu--active-p) + (corfu-previous) + (corfu-quit) + (previous-line))) :bind (:map corfu-map ("C-<return>" . corfu-insert) - ("\r" . jao-corfu-quit-or-insert))) + ("\r" . jao-corfu-quit-or-insert) + ("C-p" . jao-corfu-quit-or-previous))) (defun corfu-in-minibuffer () "Enable Corfu in the minibuffer only if Mct/Vertico are not active." |