^^^^ matches WNoBackslash
The "ms" offset is automatically set to the same value as the "lc" offset,
unless you set "ms" explicitly.
Multi-line patterns *:syn-multi-line*
The patterns can include "\n" to match an end-of-line. Mostly this works as
expected, but there are a few exceptions.
When using a start pattern with an offset, the start of the match is not
allowed to start in a following line. The highlighting can start in a
following line though. Using the "\zs" item also requires that the start of
the match doesn't move to another line.
The skip pattern can include the "\n", but the search for an end pattern will
continue in the first character of the next line, also when that character is
matched by the skip pattern. This is because redrawing may start in any line
halfway in a region and there is no check if the skip pattern started in a
previous line. For example, if the skip pattern is "a\nb" and an end pattern
is "b", the end pattern does match in the second line of this: >
x x a
b x x
Generally this means that the skip pattern should not match any characters
after the "\n".
External matches *:syn-ext-match*
These extra regular expression items are available in region patterns:
*/\z(* */\z(\)* *E50* *E52* *E879*
\z(\) Marks the sub-expression as "external", meaning that it can be
accessed from another pattern match. Currently only usable in
defining a syntax region start pattern.
*/\z1* */\z2* */\z3* */\z4* */\z5*
\z1 ... \z9 */\z6* */\z7* */\z8* */\z9* *E66* *E67*
Matches the same string that was matched by the corresponding
sub-expression in a previous start pattern match.
Sometimes the start and end patterns of a region need to share a common
sub-expression. A common example is the "here" document in Perl and many Unix
shells. This effect can be achieved with the "\z" special regular expression
items, which marks a sub-expression as "external", in the sense that it can be
referenced from outside the pattern in which it is defined. The here-document
example, for instance, can be done like this: >
:syn region hereDoc start="<<\z(\I\i*\)" end="^\z1$"
As can be seen here, the \z actually does double duty. In the start pattern,
it marks the "\(\I\i*\)" sub-expression as external; in the end pattern, it
changes the \z1 back-reference into an external reference referring to the
first external sub-expression in the start pattern. External references can
also be used in skip patterns: >
:syn region foo start="start \z(\I\i*\)" skip="not end \z1" end="end \z1"
Note that normal and external sub-expressions are completely orthogonal and
indexed separately; for instance, if the pattern "\z(..\)\(..\)" is applied
to the string "aabb", then \1 will refer to "bb" and \z1 will refer to "aa".
Note also that external sub-expressions cannot be accessed as back-references
within the same pattern like normal sub-expressions. If you want to use one
sub-expression as both a normal and an external sub-expression, you can nest
the two, as in "\(\z(...\)\)".
Note that only matches within a single line can be used. Multi-line matches
cannot be referred to.
==============================================================================
9. Syntax clusters *:syn-cluster* *E400*
:sy[ntax] cluster {cluster-name} [contains={group-name}..]
[add={group-name}..]
[remove={group-name}..]
This command allows you to cluster a list of syntax groups together under a
single name.
contains={group-name}..
The cluster is set to the specified list of groups.
add={group-name}..
The specified groups are added to the cluster.
remove={group-name}..
The specified groups are removed from the cluster.
A cluster so defined may be referred to in a contains=.., containedin=..,
nextgroup=.., add=.. or remove=.. list with a "@" prefix. You can also use
this notation to implicitly declare a cluster before specifying its contents.
Example: >
:syntax match Thing "# [^#]\+ #"