How to Delete Blank Lines in Vim

To delete all blank lines in a file using Vim (or nvim), you can do this:

:g/^\s*$/d

Read more here.

Comments

Let us know your comments by tweeting to @codeselfstudy or emailing [email protected].
(The commenting system here is offline for the moment but will return soon. This blog is still under construction.)

Return to the Code Self Study Blog.