Delete unnecessary Spaces
End of line: $
Beginning of line: ^
Space: \ s
Space at the end of the line: \ s \ + $
Space at the beginning of the line: ^ \ + \ s
Some people think that the space at the end of a row is useless and ugly. To delete unnecessary spaces behind these lines, you can
Run the following command:
: % S/\ s \ + $ //
The command specifies that the range is "%", so this will apply to the entire file. The matching mode of the "substitute" command is
"\ S \ + $ ". This indicates one or more (\ +) spaces (\ s) before the end of the line ($ ). What will we introduce later?
Write this mode.
The "to" part of the replacement command is empty :"//". In this way, the matching spaces are deleted.
Another unused space is the character before the tab. This can be deleted without affecting the format. But this is not always the case
Sample! Therefore, you 'd better manually delete it. Run the following command:
/
You can't see anything. In fact, this is a space and a tab key. It is equivalent to "/<space> <tab> ". Now,
You can use "X" to delete unnecessary spaces and ensure that the format is not changed. Then you can use "N" to find the next
And repeat the operation.