Configuration 改变vim';线条状态颜色

Configuration 改变vim';线条状态颜色,configuration,vim,Configuration,Vim,我已成功设置我的linestatus配置。然而,唯一缺少的是一些背景色,无论是整行还是特定元素。如何设置它们?您需要将颜色定义为新的突出显示组User1、User2等: hi User1 ctermbg=blue ctermfg=white guibg=blue guifg=white hi User2 ctermbg=black ctermfg=red guibg=black guifg=red 然后可以在statusline字符串中指定它们,如下所示: se

我已成功设置我的
linestatus
配置。然而,唯一缺少的是一些背景色,无论是整行还是特定元素。如何设置它们?

您需要将颜色定义为新的突出显示组User1、User2等:

hi User1 ctermbg=blue    ctermfg=white   guibg=blue    guifg=white
hi User2 ctermbg=black   ctermfg=red     guibg=black   guifg=red
然后可以在statusline字符串中指定它们,如下所示:

set statusline=
set statusline+=%1*   " Switch to colour User1
set statusline+=%F
set statusline+=%*    " Switch to default colour
set statusline+=%P
set statusline+=%2*   " Switch to colour User2
set statusline+=%c
编辑

这可能属于一个新问题,但下面是我用于查找高亮组的现有颜色的方法。在本例中,我将
折叠
语法设置为与当前
正常
语法相同。为此,我将
hi Normal
的输出定向到一个变量,然后从中提取各种信息

redir => hinorm
sil exe 'hi Normal'
redir END
if hinorm =~ 'cleared'
    sil exe 'hi clear Folded'
else
    let guibg = matchstr(strtrans(hinorm),'guibg=[#a-zA-Z0-9]*')
    let guifg = matchstr(strtrans(hinorm),'guifg=[#a-zA-Z0-9]*')
    sil exe 'hi Folded ' . guibg
    sil exe 'hi Folded ' . guifg
endif

如果有更干净的方法,请告诉我

寻找一个例子通过任何更改,您是否找到了了解Solarized颜色或任何其他方案正在使用的颜色的方法,因此我可以自动查看其默认fg和bg颜色?这可能属于一个新问题,但我添加了查找当前fg/bg颜色的方法。希望能有帮助。