Vim 使用自定义匹配扩展colorscheme

Vim 使用自定义匹配扩展colorscheme,vim,Vim,My Color Scheme(明晚)公开了以下颜色变量: " Default GUI Colours let s:foreground = "c5c8c6" let s:background = "1d1f21" let s:selection = "373b41" let s:line = "282a2e" let s:comment = "969896" let s:red = "cc6666" let s:orange = "de935f" let s:yellow = "f0c674"

My Color Scheme(明晚)公开了以下颜色变量:

" Default GUI Colours
let s:foreground = "c5c8c6"
let s:background = "1d1f21"
let s:selection = "373b41"
let s:line = "282a2e"
let s:comment = "969896"
let s:red = "cc6666"
let s:orange = "de935f"
let s:yellow = "f0c674"
let s:green = "b5bd68"
let s:aqua = "8abeb7"
let s:blue = "81a2be"
let s:purple = "b294bb"
let s:window = "4d5057"
我期待着创造新的比赛和突出小组重用这些颜色

例如,我试图用
s:red
突出显示我自己的
LESSVariable
组,我尝试:

hi LESSVariable guifg=s:red
call <SID>X("LESSVariable", s:red, "", "")
从上面变量中的
let
关键字,我可以推断这些变量仅在主题文件中可见

我能做些什么来实现这一点

如果无法直接使用
s:red
变量,我是否可以告诉Vim我的
LESSVariable
组应该看起来像组X(例如,像
rubyConstant

编辑:明晚将gui十六进制转换为字符颜色,以支持终端。如果可能,我希望在我的定制中同时支持GUI和终端。

  • 简单的方法

    不要创建您自己的高光组,而是使用一个已经由您的colorscheme定义并且看起来像您想要的高光组。例如:

    call <SID>X("WarningMsg", s:red, "", "")
    call <SID>X("Identifier", s:red, "", "none")
    call <SID>X("vimCommand", s:red, "", "none")
    etc…
    
    呼叫X(“警告消息”,s:red,”,“”)
    呼叫X(“标识符”,s:red,“,”无”)
    调用X(“vimCommand”,s:red,”,“none”)
    等等…
    
  • 另一种简单的方法

    将突出显示组添加到配色方案中

  • 另一个简单的方法

    使用已经有你想要的

call <SID>X("WarningMsg", s:red, "", "")
call <SID>X("Identifier", s:red, "", "none")
call <SID>X("vimCommand", s:red, "", "none")
etc…