vim delete operation

Delete blank lines

:g/^$/d

Delete blank lines and spaces only line

:g/^\s*$/d

Delete line begins with # or a space or tab # # beginning

:g/^\s*#/d


--------------------

Delete blank lines

:g/^$/d

Delete blank lines and spaces only line

:g/^\s*$/d

Delete line begins with # or a space or tab # # beginning

:g/^\s*#/d

For the php.ini configuration file, annotated; beginning

:g/^\s*;/d

Using regular expressions Delete Row

If the current line contains bbs, delete the current row

:/bbs/d

Delete from the second line to include a section line bbs

:2,/bbs/d

Delete a row from the line to the last line contains bbs range

:/bbs/,$d

Delete all lines containing the bbs

:g/bbs/d

Bbs delete matching rows in front and only one character

:g/.bbs/d

Bbs delete matching rows and with it the beginning of the

:g/^bbs/d

Bbs delete matching rows and with it the end of the

:g/bbs$/d

.ini comment is; the beginning, if not in the comment line at the beginning, then deleted; and later character

:%s/\;.\+//g

After you delete all the characters #

%s/\#.*//g

Guess you like

Origin www.cnblogs.com/wang--lei/p/11718597.html
Recommended