emacs-which-key icon indicating copy to clipboard operation
emacs-which-key copied to clipboard

possible to rename existing prefix?

Open mmcnl opened this issue 4 years ago • 2 comments

Hello and thank you @justbur for providing such a helpful package!

I'm wondering if it's possible to rename an existing prefix that's already been defined (in my case by spacemacs). (The functionality to rename an existing command works perfectly:

    (which-key-add-key-based-replacements "SPC :" "abc") ;; changes command name as expected to 'abc'

But if I wanted to rename the SPC a prefix (currently applications in spacemacs), this code doesn't seem to do anything for me:

(which-key-add-key-based-replacements "SPC a" "abc")

If this is possible, what's the correct approach?

mmcnl avatar Dec 27 '20 17:12 mmcnl

It depends a bit on how spacemacs is defining the prefix name, but there should be a way to override it. It's possible the prefix naming is being deferred, so they are renaming it after you do.

The simplest way to do it might be to use a method that has higher precedence on which-key's side. If you know the keymap that the key definition is going into you can try

(which-key-add-keymap-based-replacements keymap "SPC a" "abc")

justbur avatar Apr 07 '21 00:04 justbur

Cool, thanks for the tip @justbur! :)

mmcnl avatar Apr 07 '21 01:04 mmcnl