Vim remove trailing whitespace
:s/\s\+$//
:%s/\s\+$//
Explanation:
%
= from whole file
s
= search and replace
\s\+$
= regex searching for spaces til the end of a line
/
= replacement value (empty string)
Source: http://stackoverflow.com/questions/3474709/delete-all-spaces-and-tabs-at-the-end-of-my-lines