I want trailing and leading whitespaces to be highlighted by vim. I created a ~/.vimrc file and appended this:
" highlight trailing and leading whitespaces highlight TrailingWhitespaces ctermbg=red match TrailingWhitespaces /\s\s*$/ highlight LeadingWhitespaces ctermbg=red match LeadingWhitespaces /^\s\s*/
For some reason
/^\s+/ didn't work at all it matched
+ literally - i.e.
As you can see, leading whitespaces are highlighted but trailing ones are not. Once I put the
LeadingWhitespaces at the top, only trailing whitespaces are highlighted:
What am I not doing right?
I don't think there is a conflict with any other options in my ~/.vimrc file but just in case, here is the whole file.