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
<<Encrypting a file within vim session and not leaving behind traces. |
Run find/replace/search on multiple files and subdirectories >>
Additional Notes
|