vim : Highlight tab with one color and spaces with another ?

spaces, tabs, vim

Solution

A simple solution would be to do something like:

:match Error /\t/
:2match Todo / /

Where `Error` and `Todo` are highlight groups from `:highlight`. This is going to take up two of your three matches and will only be temporary.

Theoretically you could use `matchadd()` or a combination of highlight groups and `:syntax match` commands in your .vimrc to make this more permanent but your question doesn't really specify if that's what you want.

Problem

How can I highlight tabs with one color and spaces with another in vim ? I know how to highlight only tabs or only spaces. And I don't know how to select the colors separately for both spaces and tabs.

Original source