質問

Suppose I have defined a bunch of syntax keyword and syntax match for some syntax group called Foo.

I would now like to define a syntax region which begins with any match on the syntax group Foo and ends with a literal tab. It would look something like this.

syntax region Bar start=Foo end='\t' 

Is this possible?

I have looked at :help :syn-pattern and :help :syn-region, but none of them address this question. This question is kind of similar, but it did not receive good answers (possibly due to lack of sufficient clarity) and is two years old.

役に立ちましたか?

解決

No, the start and end patterns of a :syn region must be a pattern; you cannot reference another syntax group. However, with use of matchgroup=, you may be able to avoid defining a separate syntax keyword / match for the start pattern. To avoid that the matchgroup highlighting also applies to the end pattern, just switch the argument order, like this:

:syntax region Bar end='\t' matchgroup=Foo start='foo'
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top