Vim logo vim online Vim Book Ad

basic Tip #372: Remove unwanted empty or blank lines for english and chinese

 tip karma   Rating 6/7, Viewed by 288 

created:   November 21, 2002 16:51      complexity:   basic
author:   slimzhao      as of Vim:   5.7

This tip is inspired by tip #72 which titled 'Remove unwanted empty lines'.
:g/^$/d
==================
Well, if the line contains <Space> and <Tab>
:g/^\s*$/d
==================
If the line contains <Space> and <Tab> and chinese character <Space>, which takes two bytes, and the ASCII is 0xA1 0xA1.

:g/^\(\s\| \)*$/d

Herein after the | I paste the `<Space> as a chinese character'.

:g/^[ \t|?]*$/d

Note the `|?' represents a single character which ascii is 0xA1, and inputed by
CTRL-VxA1

 rate this tip  Life Changing Helpful Unfulfilling 

<<Encrypting a file within vim session and not leaving behind traces. | Run find/replace/search on multiple files and subdirectories >>

Additional Notes

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
SourceForge Logo