2

I use buffer (SPC-b) prefix key very often, and would like to move its keymap to a more convenient key (e.g. SPC-v). Is there a way to achieve this without redefining the entire map?

so I would like to move:

  • SPC-b-b to SPC-v-b

  • SPC-b-d to SPC-v-d

etc...

1
  • Edited to express the question in terms of prefix keys, guessing that's what you mean. I'm not familiar with Spacemacs, so if this is not correct please reverse the edit.
    – Drew
    Commented Aug 28, 2018 at 4:35

2 Answers 2

1

Assuming that SPC-b is a prefix key (I don't use Spacemacs), just bind the key you want, which I guess is SPC-v, to whatever SPC-b is currently bound to. Then, if you want to unbind SPC b just bind it to nil.

The command that SPC-b is currently bound to is what this returns:

(symbol-function (key-binding (kbd "SPC-b")))

So just use this, to bind SPC-v to the same command (which is presumably also a keymap):

(global-set-key (kbd "SPC-v") (symbol-function (key-binding (kbd "SPC-b"))))
0

I do not think so.

I read some source code of spacemacs, you can change the leader keys easily, however, the keys after leader keys are hard coded.

BTW, you should better not mess up those keys, since it will conflict with other key bindings. And, you can have your own key bindings with prefix o. In addition, the default spacemacs key bindings is intuitive and easy to remember.

2
  • 1
    Thanks for the answer, I completely agree with that you're saying. This is a good choice for the spacemacs, and is definitely "easier". But I would still prefer swapping "b" and "v". I use b a lot more than v and I'm sure I can come up with a mnemonic which work "well enough" to trick my brain into remembering them. Do you know if there a "hacky" way to do it? For example, can read all the keybindings starting with "b", and remap them in a loop?
    – Mark
    Commented Aug 27, 2018 at 18:28
  • Sorry, I do not know someone has done this. However, since you already have a clue, you can try it yourself. Commented Aug 28, 2018 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.