【发布时间】:2019-10-04 22:22:21
【问题描述】:
我想突出显示匹配此正则表达式 RED 的行:
syn match RedLine "^\*\*\* .* \*\*\*\n"
然后我想以蓝色突出显示以下行,无论它包含什么文本。
我尝试使用\zs 来匹配以下行的模式,如下所示:
syn match BlueLine "^\*\*\* .* \*\*\*\n\zs.*"
但这不起作用(我的理解是读取位置已经通过\zs之前的匹配部分)。
所以我尝试了这样的“look behind”原子:
syn match BlueLine "\(^\*\*\* .* \*\*\*\n\)\@50<=.*"
但即使有 50 字节的限制,这也太慢了。
每当上一行匹配某个模式时,我如何才能始终匹配整行?
例如
*** this line's RED since it's surrounded by pairs of 3 stars ***
this line's always BLUE because of the preceding line
【问题讨论】:
标签: vim syntax syntax-highlighting