about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-minibuffer.el
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-11-02 21:18:35 +0000
committerDavid Morgan <djm_uk@protonmail.com>2022-11-02 21:18:35 +0000
commit5e1e16827a9c0d6f689aebfe7482c69fd050afe8 (patch)
tree84b3545c15ec90b5b8c857769b880b395a5ccdc5 /.emacs.d/lisp/init-minibuffer.el
parentd0fd7364a70a4ec6ded9164f88509562db3e54a2 (diff)
downloaddotfiles-5e1e16827a9c0d6f689aebfe7482c69fd050afe8.tar.gz
Use vertico-indexed without pressing tab
Diffstat (limited to '.emacs.d/lisp/init-minibuffer.el')
-rw-r--r--.emacs.d/lisp/init-minibuffer.el30
1 files changed, 28 insertions, 2 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index 6bb3778..7507421 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -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