vim语法高亮问题

原文

foo [内容] bar '''
   更多
'''更多东西

syntax region specialCommand start='\<foo\s' end='$' skip='&$'
\   keepend contains=tripleQuoted
syntax region tripleQuoted start=+\<bar\s\+\z("""\|'''\)+ms=e+1 end='\ze\z1' contained extend

匹配是绑定至行的,因而ms=e+1在行后不工作.

syntax region tripleQuoted matchgroup=specialCommand
    \ start=+\<bar\s\+\z("""\|'''\)+
    \ end='\z1' contained extend

这样,来修复.
必须设置匹配组为父区域,matchgroup=specialCommand出现在开始和结束匹配模式前也很重要,

posted @ 2022-08-13 11:22  zjh6  阅读(24)  评论(0)    收藏  举报  来源