From 9fbc23a25b0e8ac95eec1e6678e38404f73d9fe0 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 26 Feb 2022 02:59:44 +0000 Subject: completion: corfu's C-p --- completion.org | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'completion.org') 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-" . 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." -- cgit v1.2.3