Remove empty lines by VIM global command
paul
posted @ Thu, 10 Mar 2011 21:54:21 +0800
in coding life
with tags
regular expression. vim
, 3061 readers
The VIM global command can select the lines that match a certain pattern in the scope of whole file. And the appened commands can operate on the selected lines.
Either the following command can be used to remove the empty lines.
:g/^\(\t\|\s\)*$/d
:v/\S/d
The command ':v' is similar to the command 'grep -v' which select the inverted matched lines.
\S is the meta character for the characters which is not white space or tab.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.