:g/^$/d
:g
will execute a command on lines which match a regex. The regex is ‘blank line’ and the command is :d
(delete)
More Related Contents:
- How do I exit the Vim editor?
- How to replace a character by a newline in Vim
- What is your most productive shortcut with Vim?
- Why do Vim experts prefer buffers over tabs? [closed]
- How do I exit Vim?
- Indent multiple lines quickly in vi
- Make Vim show ALL white spaces as a character
- How do I use vim registers?
- Tab key == 4 spaces and auto-indent after curly braces in Vim
- How to paste over without overwriting register
- Move entire line up and down in Vim
- Copy all the lines to clipboard
- How to effectively work with multiple files in Vim
- Traversing text in Insert mode
- Best way to insert timestamp in Vim?
- Find and replace strings in vim on multiple lines
- How do I fix the indentation of an entire file in Vi?
- Replace tabs with spaces in vim
- Where is my .vimrc file?
- Search for selection in Vim
- Is there a “vim runtime log”?
- Alt key shortcuts not working on gnome terminal with Vim
- How to prevent the cursor from moving back one character on leaving Insert mode in Vim?
- Using vim’s f command over multiple lines
- Convert ^M (Windows) line breaks to normal line breaks
- Vim: insert the same characters across multiple lines
- Remove all arbitary spaces before a line in Vim
- Can terminals detect or ?
- How to open a file in a list of files in Vim?
- Enabling markdown highlighting in Vim