How to clear trailing spaces using VIM
:%s=\s\+$== And thats it! The % tells it to be global - not just the current line. s is a shortcut for substitute. The \s (whitespace) and \+ (at least once) are regular expression terms (the + needs to be escaped, it seems…). The $ (dollar) represents the end of a line. The = are being used as delimiters, the == at the end implies that the pattern is replaced with nothing.