Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Vi command for adding blank line?

In vi, I can use o or O to add a blank line and go into insertion mode. But what if I want to stay in command mode, is there a command for this?

In googling, I'm seeing suggestions to add stuff to my vimrc, but it seems like there should be an easier way (that will always work.)
by

2 Answers

Amit8z4mc
To insert a blank line after the current line while staying in command mode, use:

: r !echo

This is the "read in a file" command, but instead of giving it a filename, we tell it to read the output of a shell command (!); that shell command, echo, simply prints a blank line. After the blank line is inserted, you remain in command mode.
Amit8z4mc
To insert a blank line after the current line while staying in command mode, use:

: r !echo

This is the "read in a file" command, but instead of giving it a filename, we tell it to read the output of a shell command (!); that shell command, echo, simply prints a blank line. After the blank line is inserted, you remain in command mode.

Login / Signup to Answer the Question.