# 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