You can delete trailing spaces with the following command.
:%s/\s\+$//e
This command is explained as follows:
:% (default would be for the current line)s/ start of the search pattern\s whitespace character\+ escaped + sign, one or more spaces should be matched$/ end of the search pattern, beginning of replacement pattern/ end of the replacement pattern. Basically, replace with nothing.e suppress error messages if no match foundYou can delete all blank lines in a file with the following command: :g/^$/d
This command is explained as follows:
:g is a global command that should occur on the entire file/ start of the search pattern^g/end of the search patternd deletes a lineYou 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.
If you want to do this for selected text then first select the text in visual mode.