I'm trying to add a keybinding by doing the following:

(global-set-key (kbd "SPC-;") 'spacemacs/default-pop-shell)

but it gets interpreted as the separate keys S, P, etc and produces the error:

global-set-key: Key sequence S P C - ; starts with non-prefix key S

What is the correct way to map something starting with SPC?

I'm not sure if any of this is specific to Spacemacs, but that's the distro I'm using.


The answer was posted by @duianto on the Spacemacs gitter:

(spacemacs/set-leader-keys (kbd ";") 'spacemacs/default-pop-shell)
|improve this answer|||||

You can use:

(kbd "<SPC> ;")
|improve this answer|||||
  • That produces the same error, but now it says that the key sequence starts with non-prefix key SPC instead of S. – kbdluv Dec 29 '17 at 17:32
  • 1
    Ah, I see. The original post contained two problems. One (which I solved) was the syntax of kbd. The other that space isn't a prefix key (which I assumed it was). – Lindydancer Dec 29 '17 at 18:26
  • 1
    Yes, sorry about the confusion. Thank you for teaching me how to use kbd with <SPC> :) – kbdluv Dec 29 '17 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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