Obsolete tip
This tip has been merged into another tip.
See VimTip285 for the current tip.
Please do not edit this tip, and do not edit the discussion page.
If anything needs to be improved, please fix VimTip285.
created September 6, 2004 · complexity basic · author Klaus Voelker · version 5.7
I found myself spending way too much time in insert mode, because it takes so much effort to hit <Esc>, or alternatively <C-[>. To train myself to use insert mode only for what it's meant for - namely inserting text - I wanted to make it as easy as possible for myself to get out of insert mode.
My solution: map <CR> to <Esc>! Pressing the return key at the end of an insert operation feels very natural, and it is one of the more accessible keys on the keyboard. For inserting multiline text, you can use Shift-Enter, which doesn't take that much getting used to.
If you want to give it a try, put the following in your vimrc:
inoremap <CR> <Esc>
Comments
It might be better to map Shift-Enter to Escape. Change the map to:
inoremap <S-CR> <Esc>
This works in the GUI-versions on Linux, Mac OS X and Windows, but not in terminal versions.