DEV Community

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

Collapse
 
iggredible profile image
Igor Irianto • Edited

I don't think it exists. But luckily, we can always map it if it doesn't exist. Something like:

:nnoremap <leader>o o<esc>

You can change <leader>o to whatever mapping you want :)

EDIT: apparently we posted (partially) exact same mapping within 5 minutes haha!!

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!