Showing trailing spaces in vim

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!


Solution 1:

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.

Solution 2:

The vim-better-whitespace plugin incorporates many tips from the Vim Wiki page referenced in @icecrime's answer. It also has some nifty configuration options.

I installed pathogen.vim just to use this plugin and am happy with my life, all things considered.