Does trailing whitespace make your blood boil? Although there are plenty of ways to automatically trim trailing whitespace when committing, or even to hide whitespace in diffs, you can easily trim whitespace in Vim with a simple plugin.

Vim SpaceJam, which was born of the dotfiles of software consultancy Hashrocket, offers a very simple solution to a very common problem: extra spaces at the end of lines. A simple command will clear any tabs or spaces erroneossly left at the end any line in the file:


You can also visual select specific lines to trim only from your selection. But a simple :Trim will clean up the whole file, leaving your lines minty fresh before you even leave the buffer.