modify vertico/corfu indexed keybindings from 1 instead of 0

old indexed keybindings from M-0 to M-9, it's not convenient,
now change keybindings from M-1 -> M-9 -> M-0, M-0 mean M-10.
This commit is contained in:
zedhugh committed 2026-05-15 22:13:46 +08:00
1 parent 190697b00e
commit 4ea679586b
1 file changed
+5 -3
+5 -3
View File
@@ -44,7 +44,7 @@
;;; indexed extension ;;; indexed extension
(let ((start 0) (let ((start 1)
(count 10)) (count 10))
(require 'vertico-indexed) (require 'vertico-indexed)
(require 'corfu-indexed) (require 'corfu-indexed)
@@ -55,8 +55,10 @@
corfu-count count corfu-count count
corfu-indexed-start start) corfu-indexed-start start)
(dotimes (i count) (dotimes (i count)
(let ((press-key (format "M-%d" i)) (let* ((n (+ i start))
(target-key (format "C-u %d RET" i))) (k (mod n count))
(press-key (format "M-%d" k))
(target-key (format "C-u %d RET" n)))
(define-key vertico-map (kbd press-key) (kbd target-key)) (define-key vertico-map (kbd press-key) (kbd target-key))
(define-key corfu-map (kbd press-key) (kbd target-key))))) (define-key corfu-map (kbd press-key) (kbd target-key)))))