Vim delete blank lines

nearly_lunchtime picture nearly_lunchtime · Apr 1, 2009 · Viewed 357.1k times · Source

What command can I run to remove blank lines in Vim?

Answer

soulmerge picture soulmerge · Apr 1, 2009
:g/^$/d

:g will execute a command on lines which match a regex. The regex is 'blank line' and the command is :d (delete)