remove trailing whitespace in vim


posted by qmx on 11 July 2010

Here’s a quick tip to highlight trailing whitespace - put this on your .vimrc:

match Todo /\s\+$/

This will flag them the same way as TODO or FIXME, with a ugly yellowish mark:

preview

To remove them, run this on normal mode:

:%s/\s\+$//e