I got this from the vim wiki and added it to my .vimrc to highlight trailing whitespace, and spaces before tabs (only when in insert mode):
highlight ExtraWhitespace guibg=purple
match ExtraWhitespace /\s\+$\| \+\ze\t/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$\| \+\ze\t/
autocmd InsertEnter * match ExtraWhitespace /\s\+$%#\@<!$\| \+\ze\t/
autocmd InsertLeave * match ExtraWhitespace /\s\+$\| \+\ze\t/
autocmd BufWinLeave * call clearmatches()
I would like to extend this to include spaces after tabs.
So, I would like to:
- Highlight all trailing whitespace.
- Highlight spaces before, and after tabs.
- Don't highlight trailing whitespace while I am typing.
How can I do this?
Since you didn't mention it at all have you tried using listchars? I have this in my .vimrc it doesn't highlight them but you can pick any special characters you want to show for them: