Vim append 2 lines

How do I append 2 lines with fewer key strokes ? Right now I do ESC o ESC o.

If the lines are consecutive, you could stay in insert mode and just jump to the next line with Enter?

what if I want to add 5 lines?

The o action accepts a range, so you can do 5o<Esc> to insert five lines. Not sure what those blank lines are getting you, though!

1 Like

Tim Pope’s unimpaired.vim provides, among many other nice shortcuts, “]” to add a line after the current one, and without entering insert mode. Similarly, “[” adds a line above the current line, and either one can take a preceding number.

Most of the unimpaired shortcuts are pairs starting with “[” and “]”.

4 Likes