Showing trailing spaces in vim

后端 未结 5 1608
生来不讨喜
生来不讨喜 2021-01-30 16:19

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 use

5条回答
  •  醉话见心
    2021-01-30 17:14

    Based on the link posted by icecrime, I find this works quite well...

    " Be clever about highlighting trailing whitespace (don't highlight it if we are
    " in 'insert' mode and the cursor is at the end of the line). Also (regardless
    " of 'insert' mode), highlight any tabs that immediately follow space(s).
    " EOLWS and EOLWSInsert are colour group names; the latter being toned-down to
    " make editing in 'insert' mode easier on the eye
    autocmd InsertEnter * match EOLWS // | match EOLWSInsert /\s\+\%#\@

    Also, make sure the 'Error' highlight group is NOT defined as inverse video - if it is, it conflicts on strange ways with the above

提交回复
热议问题