sponsor Vim development Vim logo Vim Book Ad

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

 tip karma   Rating 253/100, Viewed by 4204 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

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'.
Well, if the line contains <Space> and <Tab>
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

 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 vim@vim.org after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge.net Logo