Kungsgeten / ryo-modal

Roll your own modal mode
MIT License
222 stars 14 forks source link

`which-key` ignores `:name` for prefix keys #61

Closed Zoybean closed 4 weeks ago

Zoybean commented 4 weeks ago

which-key is always showing +prefix for prefix keys defined by ryo-modal-keys, even when I use :name. Note that this issue has different symptoms than #60.

from my init.el:

  (ryo-modal-keys
   ("%" mark-whole-buffer :first '(mc/keyboard-quit))
   ("SPC"
    (("e"
      (("b" eval-buffer)
       ("s" eval-last-sexp)
       ("e" eval-expression))
      :name "+eval")
     ("b"
      (("q" kill-buffer)
       ("w" save-buffer))
      :name "+buffer")
     ("w"
      (("q" delete-window)
       ("h" windmove-left :name "go left window")
       ("j" windmove-down :name "go down window")
       ("k" windmove-up :name "go up window")
       ("l" windmove-right :name "go right window")
       ("H" windmove-swap-states-left :name "swap left window")
       ("J" windmove-swap-states-down :name "swap down window")
       ("K" windmove-swap-states-up :name "swap up window")
       ("L" windmove-swap-states-right :name "swap right window")
       ("s" (("h" split-window-horizontally :name "split horizontal")
         ("j" split-window-vertically :name "split vertical")
         ("k" split-window-vertically :name "split vertical")
         ("l" split-window-horizontally :name "split horizontal"))
    :name "+split"))
      :name "+window"))))

after this, which-key is showing the following for SPC:

b : +prefix e : +prefix w : +prefix

but non-prefix keys are named as expected, so for SPC w it shows the defined prefixes for all but SPC w s, which still shows as +prefix

Kungsgeten commented 4 weeks ago

Hi!

Thanks for the report. Upon reading the which-key documentation I saw that the examples for naming prefix keys had changed. I've pushed a small update which I think will solve your problem (at least it works for me).