repelliuss / bind

`bind' many commands to keys in many keymaps, multiple times with support for prefix, autoload, repeat-mode and save&restore.
GNU General Public License v3.0
24 stars 2 forks source link

Is there a way to give prefix which-key label? #1

Closed aadi58002 closed 1 year ago

aadi58002 commented 1 year ago

like in general.el

"b" '(:ignore t :which-key "buffer")
"b b" 'consult-buffer
"b k" 'kill-this-buffer
"c" '(:ignore t :which-key "commands")
"c r" '(consult-complex-command :which-key "Complex Command repeat")
"f" '(:ignore t :which-key "files")
"f f" 'consult-fd

We can give name to prefix keys with :ignore (kind of)

repelliuss commented 1 year ago
(bind ((setq my-buffer-map (make-sparse-keymap))
       "k" (cons "Kill current buffer" #'kill-this-buffer))
      (my-leader-map
       "b" (cons "Buffer" my-buffer-map)))

bind-prefix currently is not capable of giving a prefix a description but you can collect those commands in one map and bind a key to a map with description through a cons cell. For more information you can see define-key. which-key is capable of processing your given string.