Paul - The Programmer

simple & stupid
Alter the word order in lines by VIM regular expression
XPath error: Cannot select a node here: the context item is an atomic value

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 , 2334 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.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter