2

for some reason i cant bind space in evil mode and get an error. all other keys work well. any clue? this is the bind that dosent seem to work

(define-key evil-normal-state-map "<SPC>" 'hydra-leader/body)

here is the error i get when launching emacs: Error (use-package): evil :config: Key sequence < S P C > starts with non-prefix key <

  • If you get an error, show the exact error to us. We're after all not psychics... – wasamasa Jun 22 '16 at 6:12
  • good point ;-) here is the error i get when launching emacs: Error (use-package): evil :config: Key sequence < S P C > starts with non-prefix key < – zeltak Jun 22 '16 at 6:44
  • Try "SPC" instead? I think you're mixing notations (<space> vs SPC) – VanLaser Jun 22 '16 at 7:13
  • 1
    No, it's not. As I said before, try either (kbd "SPC"), [space], or simply " " instead. If you read the error, it believes you're trying to map a sequence of 3 keys, the first one being S. – VanLaser Jun 22 '16 at 10:21
  • 1
    thx! ```(kbd "SPC")`` did the trick! – zeltak Jun 22 '16 at 15:49
2

The error code shows that emacs believes you want to map a sequence of 3 keys (S P C), the first one being S, but it can't do that since S is already used by itself (i.e. not a prefix key).

You can use either (kbd "SPC"), [space] or simply " " instead. For example:

 (define-key evil-normal-state-map (kbd "SPC") 'hydra-leader/body)

For the right key syntax, see for example the "How to find key syntax" question at this Xah tutorial page.

(basically, use C-h k with the key or key combination you want, in order to see how the output is formatted).

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.