My current vim syntax highlighting (maximum awesome) shows a few things that my coworker’s editors don’t. Mainly showing tabs that other’s have typed (since maximum awesome expands tabs to spaces so they won’t show up) and trailing whitespace. I’m a huge fan of this since it makes sure that the code I’m writing doesn’t have unnecessary characters.
But working on old code that’s been written and rewritten by a bunch of different people who really had no interest in keeping to syntax standards, these show up as ugly splotches on what should be a clean vim window. Luckily, as is often the case, there are two vim commands that can turn a mess of a file into something a little better.
:retab
Retab works to change all the tabs in the file, and “redoes” them in whatever format defined in your vimrc. If you’re using maximum awesome, that would be :expandtab, which, like I mentioned, expands a tab into the corresponding number of spaces (which is set to 2 in maximum awesome). So :retab changes all the garbage tabs into 2 spaces.
:%s/\s\+$//
A little funking syntax, but this command (found by googling) finds and removes all the trailing whitespace.
With these two commands, and a little more formatting to make sure that the indentions are correct, a file that looks confusing because of poor syntax becomes something much more understandable. And it helps out everyone in the future who has to work on the file. Both outcomes make it worth the time and effort.