I have the following lines in my vimrc file:
hi ExtraWhitespace cterm=NONE ctermbg=green ctermfg=green guibg=green guifg=green
match ExtraWhitespace /\s\+$\|\t/
These lines will highlight all lines with no characters other than spaces as well as any tab. I would like to add a function that will toggle highlighting the whitespace.
map <F8> :call ToggleWhitespaceMatching()<cr>
I have tried to write my own, but have not been able to get it working. Could someone please suggest a function to accomplish this. Also, i would like the matching to be on, by default.
Similar idea to kev's but toggles the hilighting instead of the match