0

I'm using spacemacs in evil mode and I'd like to remap my escape key to the right arrow key (It's easily accessible for me due to a global remapping which is useful in another application). I had most success so far with either of these commands:

(global-set-key (kbd "<right>") (kbd "<escape>"))
(global-set-key (kbd "<right>") 'evil-escape)

However, there is one thing I didn't manage to get right yet. When I press, for example 'd', it expects another key (like another 'd' to delete the whole line), but pressing won't abort that key sequence. How can I achieve this?

1 Answer 1

0

Set (define-key evil-motion-state-map (kbd "<right>") 'evil-normal-state)

The documentation for evil-scape is here: http://spacemacs.org/doc/DOCUMENTATION.html#escaping

11
  • I just did, it didn't work. But if I understand it correctly, it expects a key sequence, not a single key. How would I do that? I already tried ["<right>"] and (kbd "<right>") without success.
    – Shadowigor
    Commented Jan 20, 2017 at 8:50
  • Try binding it directly as stated here: github.com/syl20bnr/evil-escape/blob/master/…
    – mclear
    Commented Jan 20, 2017 at 22:11
  • you might also bypass evil-escape entirely and bind it this way: (define-key evil-insert-state-map (kbd "<right>") 'evil-normal-state)
    – mclear
    Commented Jan 21, 2017 at 0:59
  • Unfortunately, neither worked.
    – Shadowigor
    Commented Jan 21, 2017 at 23:22
  • So (define-key evil-insert-state-map (kbd "<right>") 'evil-normal-state) works for me. You might have to disable evil-escape first though. If it doesn't work for you then there is likely something else in your config that is inhibiting it.
    – mclear
    Commented Jan 22, 2017 at 0:47

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.