Vim 使用日光化配色方案突出显示 [英] Vim highlighting with solarized color scheme
问题描述
我有一个 vim 高亮显示代码中的空白错误:
" 突出显示多余的空格和制表符.突出显示冗余空间 ctermbg=red匹配 RedundantSpaces/\s\+$\|\+\ze\t\|\t/
显示尾随空格问题,如下所示:
但是,我最近开始使用 ;插件页面包含指向替代品的链接.
I have a vim highlight to display whitespace errors in code:
" Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red
match RedundantSpaces /\s\+$\| \+\ze\t\|\t/
Which displays trailing whitespace problems like this:
However, i've recently started using the solarized color scheme and I am not able to get these highlights to display.
I've tried changing the color names to no avail. The relevant part of my (simple) .vimrc says:
syntax enable
set background=dark
colorscheme solarized
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:
- It does not highlight in split windows.
- 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.
这篇关于Vim 使用日光化配色方案突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!