Mapping "jk" to Escape in Emacs' evil-mode

I'm a Vim user. But more & more these days I find that one of my favourite versions of Vim is Emacs. Specifically, its evil-mode package, which is a very good Vim emulator1.

If you get started with evil-mode, one of the first questions you might ask is, "How do I remap ESC to something more finger-friendly?" Some people like to map jj. Personally I like jk, because it rolls off the fingers a little more easily.

Anyway, there are a couple of ways to do it in Emacs. The simplest & cleanest I've found is to install the key-chord package:

M-x package-install
key-chord

...then add this to your .emacs file:

(require 'key-chord)
(key-chord-mode 1)
(key-chord-define evil-insert-state-map  "jk" 'evil-normal-state)

Easy.


  1. Actually, it's the only good Vim emulator/plugin I've ever encountered.