gpt4 book ai didi

configuration - 更改 vim 的 linestatus 颜色

转载 作者:行者123 更新时间:2023-12-04 06:05:22 26 4
gpt4 key购买 nike

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

最佳答案

您需要将颜色定义为新的高亮组 User1、User2 等:

hi User1 ctermbg=blue    ctermfg=white   guibg=blue    guifg=white
hi User2 ctermbg=black ctermfg=red guibg=black guifg=red

然后您可以在状态行字符串中指定它们,如下所示:
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

编辑

这可能属于一个新问题,但这是我用来查找突出显示组的现有着色的方法。在这个例子中,我设置了 Folded语法与当前 Normal 相同句法。我通过指导 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

如果有更清洁的方法,请告诉我!

关于configuration - 更改 vim 的 linestatus 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8383787/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com