Following up this old thread with vim highlighting the whitespaces in red, this did not work anymore in recent debian releases, now shipping >7.1 as versions. I never really cared about that non-functionality since git diff always worked showing bad code style.

Until now, when things become annoying. The reason is simple – the highlight match does not seem to work anymore, but luckily there’s a new possibility mention on the vim wiki. I prefer to have it system-wide, you may just use vimrc.local or $HOME/.vimrc

# vim /etc/vim/vimrc

highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /s+$/
autocmd BufWinEnter * match ExtraWhitespace /s+$/
autocmd InsertEnter * match ExtraWhitespace /s+%#@<!$/
autocmd InsertLeave * match ExtraWhitespace /s+$/
autocmd BufWinLeave * call clearmatches()

Having that fixed, removing all trailing whitespaces at the end is tremendously easy too

%d bloggers like this: