Add a line above or below

2.1
(419)

If you don’t have Tim Pope’s unimpaired.vim, you should. Unimpaired adds many useful pairs of mappings including one for adding an empty line above or below your current line.

In normal mode, use [<Space> and ]<Space> to add an empty line either above or below your current line. With your cursor on the def bar line below, tap [<Space> and a line will be effortlessly inserted above while your cursor remains on its line:

def foo
end
█ef bar
end

Tap [<Space>and a line is instantly inserted:

def foo
end

█ef bar
end

Here’s a quick demo of this in action:

How useful was this tip?

Average rating 2.1 / 5. Vote count: 419

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

90 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts

Leave a reply

Your email address will not be published. Required fields are marked *