diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-11-02 21:07:56 +0000 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-11-02 21:07:56 +0000 |
commit | 0e54179c77e18d419693ca4ddef0f1173fb9326a (patch) | |
tree | 1c74a86b10e8272df4994af7ac2dc51d10ab1ba0 /.emacs.d | |
parent | 7c265112e807c7bbe38d88c7175b5bf1f5b41511 (diff) | |
download | dotfiles-0e54179c77e18d419693ca4ddef0f1173fb9326a.tar.gz |
Use vertico-indexed without pressing enter
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/lisp/init-minibuffer.el | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el index 2a32802..b17c2ae 100644 --- a/.emacs.d/lisp/init-minibuffer.el +++ b/.emacs.d/lisp/init-minibuffer.el @@ -151,7 +151,38 @@ DEFS is a plist associating completion categories to commands." (add-to-list 'savehist-additional-variables 'vertico-repeat-history)) (use-extension vertico vertico-indexed - :config (vertico-indexed-mode 1)) + ;; TODO why doesn't bind-key/define-key work in the macro + :bind (:map vertico-map + ("C-0" . vertico-indexed-choose-0) + ("C-1" . vertico-indexed-choose-1) + ("C-2" . vertico-indexed-choose-2) + ("C-3" . vertico-indexed-choose-3) + ("C-4" . vertico-indexed-choose-4) + ("C-5" . vertico-indexed-choose-5) + ("C-6" . vertico-indexed-choose-6) + ("C-7" . vertico-indexed-choose-7) + ("C-8" . vertico-indexed-choose-8) + ("C-9" . vertico-indexed-choose-9)) + :config + (defmacro def-choose (n) + `(defun ,(intern (format "vertico-indexed-choose-%s" n)) () + ,(message "Exit minibuffer with candidate %s" n) + (interactive) + (let ((current-prefix-arg ,n)) + (message "%s" current-prefix-arg) + (funcall-interactively 'vertico-exit)))) + ;; TODO why doens't this work in dotimes + (def-choose 0) + (def-choose 1) + (def-choose 2) + (def-choose 3) + (def-choose 4) + (def-choose 5) + (def-choose 6) + (def-choose 7) + (def-choose 8) + (def-choose 9) + (vertico-indexed-mode 1)) (use-extension vertico vertico-quick :bind (:map vertico-map |