Auto remove trailing whitespace
Copy this in your .vimrc.local, and any trailing whitespace will be highlighted, and automatically removed when you write the file.
"highlight trailing whitespace
match ErrorMsg '\s\+$'
" kill trailing whitespaces automatically
autocmd BufWritePre * :%s/\s\+$//e
Yes, I totally stole this from someone else's vimrc on github. https://github.com/rwz/dotfiles/blob/master/vim/vimrc
Tweet