This question already has an answer here:

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?

marked as duplicate by phils, Drew, zck, Community Oct 13 '18 at 10:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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. – DoMiNeLa10 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