I am trying to customize the behaviour of Enter
key in Normal
mode in Vim.
Here is my .vimrc
:
nmap <CR> o<Esc>
nmap <S-CR> i<CR><Esc>
I am trying to make Enter simply append a newline after the current line when pressed. However, when the Shift-Enter
combination is pressed, I want to break the current line at the cursor.
The latter does not work. Whenever I press Shift-Enter
it just appends a line without breaking it at the cursor.
i<CR><ESC>
to <C-J>. That results in a nice <S-J> and <C-J> duality for splitting and joining lines. And use unimpaired’s]<space>
for adding empty lines (as proposed by Peter Rickner).