I have a vim highlight to display whitespace errors in code:
\" Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red
match Redunda
Moving the :highlight
after the :colorscheme
still doesn't help you when you switch colorschemes in the Vim session.
For that to work, re-define your highlighting via the ColorScheme
event:
autocmd ColorScheme * highlight RedundantSpaces ctermbg=red
BTW, your minimalistic solution has other problems:
:match
.There are several plugins that offer this functionality, in a better way. Mine is called ShowTrailingWhitespace; the plugin page contains links to alternatives.