Use vertico-indexed without pressing tab

This commit is contained in:
David Morgan 2022-11-02 21:18:35 +00:00
parent d0fd7364a7
commit 5e1e16827a
Signed by: djm
GPG Key ID: C171251002C200F2
1 changed files with 28 additions and 2 deletions

View File

@ -162,14 +162,30 @@ DEFS is a plist associating completion categories to commands."
("C-6" . vertico-indexed-choose-6)
("C-7" . vertico-indexed-choose-7)
("C-8" . vertico-indexed-choose-8)
("C-9" . vertico-indexed-choose-9))
("C-9" . vertico-indexed-choose-9)
("M-0" . vertico-indexed-insert-0)
("M-1" . vertico-indexed-insert-1)
("M-2" . vertico-indexed-insert-2)
("M-3" . vertico-indexed-insert-3)
("M-4" . vertico-indexed-insert-4)
("M-5" . vertico-indexed-insert-5)
("M-6" . vertico-indexed-insert-6)
("M-7" . vertico-indexed-insert-7)
("M-8" . vertico-indexed-insert-8)
("M-9" . vertico-indexed-insert-9))
:config
(defmacro def-choose (n)
`(defun ,(intern (format "vertico-indexed-choose-%s" n)) ()
,(message "Exit minibuffer with candidate %s" n)
,(message "Exit minibuffer with candidate %s." n)
(interactive)
(let ((current-prefix-arg ,n))
(funcall-interactively 'vertico-exit))))
(defmacro def-insert (n)
`(defun ,(intern (format "vertico-indexed-insert-%s" n)) ()
,(message "Insert candidate %s in minibuffer." n)
(interactive)
(let ((current-prefix-arg ,n))
(funcall-interactively 'vertico-insert))))
;; TODO why doens't this work in dotimes
(def-choose 0)
(def-choose 1)
@ -181,6 +197,16 @@ DEFS is a plist associating completion categories to commands."
(def-choose 7)
(def-choose 8)
(def-choose 9)
(def-insert 0)
(def-insert 1)
(def-insert 2)
(def-insert 3)
(def-insert 4)
(def-insert 5)
(def-insert 6)
(def-insert 7)
(def-insert 8)
(def-insert 9)
(vertico-indexed-mode 1))
(use-extension vertico vertico-quick