Recently I tried Emacs and found Evil helpful to keep my vim custom. I'm used to typing "jj" to return normal mode from insert mode like many Vimers do but don't know how to make it in Evil mode.
I map it like this but seems not correct:
(define-key evil-insert-state-map (kbd "jj") 'evil-normal-state)
This works for me. It requires the KeyChord library:
;;Exit insert mode by pressing j and then j quickly
(setq key-chord-two-keys-delay 0.5)
(key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
(key-chord-mode 1)
It is inspired by @phils answer above and based on Simon's Coding Blog: Emacs and Unity Every Day.
I don't know whether it works with Evil, but for Emacs in general the KeyChord library is designed for this sort of thing.
Try it and see?
(key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
If you're using Spacemacs then I just found that this setting (added to the beginning of user-init
) works very well,
(setq-default evil-escape-key-sequence "jj")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With