To delete all lines that are empty in vim:
:g/^$/d
To delete all empty lines or empty lines that contain spaces:
:g/^\s*$/d
Note that \s represents the space character in the regular expression. Or simply, you can also represent the space character with [ ]:
:g/^[ ]*$/d
:g/^$/d
To delete all empty lines or empty lines that contain spaces:
:g/^\s*$/d
Note that \s represents the space character in the regular expression. Or simply, you can also represent the space character with [ ]:
:g/^[ ]*$/d
No comments:
Post a Comment