Showing trailing spaces in vim

lyuba picture lyuba · Jan 6, 2011 · Viewed 39.8k times · Source

I've set the following options in .vimrc

set listchars=tab:▸\ ,trail:·
set list

And expected to see dots in those places where spaces are used for tabulation in the code (I use spaces, not tabs). However, the result is different:

enter image description here

Could you please recommend how to reach the desired result? Thanks!

Answer

icecrime picture icecrime · Jan 6, 2011

You should check this link. I'm using the match command solution :

:highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+$/

This page also provides list based solutions which I haven't personally tried.