I have re-assigned the RETURN key to exit the insert state in Evil mode.

(define-key evil-insert-state-map [return] 'evil-normal-state)

But this does't work with emacs -nw in terminal. Any way to make it work?

  • 3
    Terminals do not send [return]. Use (kbd "RET") which will work in and out of terminals. Note that you can ask Emacs -- C-h k would have told you how that key was described. – phils Oct 12 '18 at 21:32
  • 2
    Writing vectors with keys isn't the cleanest ways to define keybindings, kbd allows you to use the Emacs notation for keys, and it will make your init file more readable for everyone, including you. – user12563 Oct 12 '18 at 21:59
  • @phils Thanks! And thanks for the tip with C-h k. – A. Blizzard Oct 12 '18 at 21:59
  • @DoMiNeLa10 OK. Thanks. I will keep that in mind! – A. Blizzard Oct 12 '18 at 22:01