To my knowledge nobody says this is "best practice," and I would advise against it.
If you really want to do this, though, try this mapping:
:inoremap <CR> <Esc>o
There's a wealth of information in ":help map.txt" that could help you understand how to map in various modes, but briefly this sets a mapping in insert mode, doesn'...
None of the solutions worked for me.
The problem was that I was using MobaXTerm, which replaced backspace with C-h by default, and had this line in ~/.vimrc:
inoremap <C-h> <Left>
as a result, effectively, all my backspaces were replaced with <Left> keypresses.
The solution was to go to MobaXTerm settings -> Terminal -> Local shell ...
Simply because a line break in the replacement component of the substitution command is represented by \r in Vim rather than \n...
Alernatively, you can use this:
Where the ^M is entered by typing Ctrl+V then Enter
See :h s/\r and :h s/<CR>
FYI using \n will...
insert a <NL> (<NUL> in the file) (does NOT break the ...