3

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:

  1. Highlight all trailing whitespace.
  2. Highlight spaces before, and after tabs.
  3. Don't highlight trailing whitespace while I am typing.

How can I do this?

user1186344
  • 31
  • 1
  • 2

1 Answers1

1

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:

set listchars=eol:$,tab:>-,trail:ยท,extends:>,precedes:<
ThePosey
  • 2,734
  • 2
  • 19
  • 20