You can delete trailing spaces with the following command.
:%s/\s\+$//e
This command is explained as follows:
enter Command mode with :
do this to the entire file with % (default would be for the current line)
substitute action s
/ start of the search pattern
\s whitespace character
\+ e...
You can delete all blank lines in a file with the following command:
:g/^$/d
This command is explained as follows:
enter Command mode with :
g is a global command that should occur on the entire file
/ start of the search pattern
the search pattern of blank line is ^g
/end of the search pat...
You can convert tabs to spaces by doing the following:
First check that expandtab is switched off
:set noexpandtab
Then
:retab!
which replaces spaces of a certain length with tabs
If you enable expandtab again :set expandtab then and run the :retab! command then all the tabs becomes spaces...