I set up vim to use enter to get out of insert mode. This prevents frequently having to reach for the escape key or use a multi-key combination. To insert a new line while in insert mode, I now use shift-enter.
An idea I had this morning is to make shift-enter swap the shift-enter and enter bindings. This way, if I’m in the mode of writing something new without manipulating text, I can push shift-enter once to enter a newline, then push enter for each additional newline, and push shift-enter when I’m done to get out of insert mode.
To implement it, I created a function that toggles the bindings, and added a call to the function to my bindings for <S-Enter>.
function ToggleEnterMappings() if mapcheck("<CR>", "i") == "<Esc>" iunmap <CR> inoremap <S-Enter> <C-o>:call ToggleEnterMappings()<CR><Esc> else inoremap <CR> <Esc> inoremap <S-Enter> <C-o>:call ToggleEnterMappings()<CR><CR> endif endfunction call ToggleEnterMappings()
Time will tell whether this is a good setup for me. I think if I do single-line inserts much more often than I do multi-line inserts it might.