是否有可能只在某个语法区域内进行语法匹配(而不是关键字)?不久前,我遇到了这个问题,并提出了以下建议:
" lua.vim
syntax include @loveconf <sfile>:p:h/love-conf.vim
" Some time later
syntax region loveconfregion start="\<love\.conf\>" end="\<end\>"me=e-3,he=e-3,re=e-3 skipwhite skipempty containedin=ALLBUT,luaString,luaComment contains=ALL
highlight loveconf ctermfg=206其中love-conf.vim看起来像这样:
" Simple example; actual file contains a regex
syntax match loveconf "\.window\.width" containedin=loveconfregion如果可能的话,我想把它全部移到一个文件中。有没有办法做到这一点?
作为指导,这里有一个示例文件:
-- test.lua
t.window.width = 20
-- ^ Not colored
function randomFunction()
t.window.width = 20
-- ^ Also not colored
end
function love.conf( t )
t.window.width = 20
-- ^ Colored
endhttps://stackoverflow.com/questions/47463058
复制相似问题