DEV Community

Discussion on: The Only Vim Insert-Mode Cheatsheet You Ever Needed

Collapse
 
snawaz profile image
Sarfaraz Nawaz

Eventually, I used this instead:

nnoremap <silent> oo :<C-u>call append(line("."),   repeat([""], v:count1))<CR>
nnoremap <silent> OO :<C-u>call append(line(".")-1, repeat([""], v:count1))<CR>  
Enter fullscreen mode Exit fullscreen mode

It has 3 advantages:

  • first) I dont have to hit two different keys, instead press the same key twice (quickly though),
  • second) the cursor stays on the same line as it was before.
  • third) I can insert more than one lines like this: 10oo which inserts 10 lines after the current one!

Not my solution. I just copied it from here: vi.stackexchange.com/a/3881/21711 .. That's a great answer!