Vim highlighting with solarized color scheme

后端 未结 1 1846
醉梦人生
醉梦人生 2021-01-17 22:31

I have a vim highlight to display whitespace errors in code:

\" Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red
match Redunda         


        
相关标签:
1条回答
  • 2021-01-17 23:19

    Moving the :highlight after the :colorscheme still doesn't help you when you switch colorschemes in the Vim session.

    For that to work, re-define your highlighting via the ColorScheme event:

    autocmd ColorScheme * highlight RedundantSpaces ctermbg=red
    

    BTW, your minimalistic solution has other problems:

    1. It does not highlight in split windows.
    2. You lose the ability of quickly highlighting custom stuff via :match.

    There are several plugins that offer this functionality, in a better way. Mine is called ShowTrailingWhitespace; the plugin page contains links to alternatives.

    0 讨论(0)
提交回复
热议问题