vimindentation

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

  • 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.