Home Explore Blog CI



neovim

56th chunk of `runtime/doc/syntax.txt`
6a07998f40a2df3c2e94a3a6ab136da3c072950f245c59af0000000100000fa2
 higher priority than other items.

Example: >
  :syn match ifstart "\<if.*"	  nextgroup=ifline skipwhite skipempty
  :syn match ifline  "[^ \t].*" nextgroup=ifline skipwhite skipempty contained
  :syn match ifline  "endif"	contained
Note that the "[^ \t].*" match matches all non-white text.  Thus it would also
match "endif".	Therefore the "endif" match is put last, so that it takes
precedence.
Note that this example doesn't work for nested "if"s.  You need to add
"contains" arguments to make that work (omitted for simplicity of the
example).

IMPLICIT CONCEAL					*:syn-conceal-implicit*

:sy[ntax] conceal [on|off]
	This defines if the following ":syntax" commands will define keywords,
	matches or regions with the "conceal" flag set. After ":syn conceal
	on", all subsequent ":syn keyword", ":syn match" or ":syn region"
	defined will have the "conceal" flag set implicitly. ":syn conceal
	off" returns to the normal state where the "conceal" flag must be
	given explicitly.

:sy[ntax] conceal
	Show either "syntax conceal on" or "syntax conceal off".

==============================================================================
8. Syntax patterns				*:syn-pattern* *E401* *E402*

In the syntax commands, a pattern must be surrounded by two identical
characters.  This is like it works for the ":s" command.  The most common to
use is the double quote.  But if the pattern contains a double quote, you can
use another character that is not used in the pattern.	Examples: >
  :syntax region Comment  start="/\*"  end="\*/"
  :syntax region String   start=+"+    end=+"+	 skip=+\\"+

See |pattern| for the explanation of what a pattern is.  Syntax patterns are
always interpreted like the 'magic' option is set, no matter what the actual
value of 'magic' is.  And the patterns are interpreted like the 'l' flag is
not included in 'cpoptions'.  This was done to make syntax files portable and
independent of the 'magic' setting.

Try to avoid patterns that can match an empty string, such as "[a-z]*".
This slows down the highlighting a lot, because it matches everywhere.

						*:syn-pattern-offset*
The pattern can be followed by a character offset.  This can be used to
change the highlighted part, and to change the text area included in the
match or region (which only matters when trying to match other items).	Both
are relative to the matched pattern.  The character offset for a skip
pattern can be used to tell where to continue looking for an end pattern.

The offset takes the form of "{what}={offset}"
The {what} can be one of seven strings:

ms	Match Start	offset for the start of the matched text
me	Match End	offset for the end of the matched text
hs	Highlight Start	offset for where the highlighting starts
he	Highlight End	offset for where the highlighting ends
rs	Region Start	offset for where the body of a region starts
re	Region End	offset for where the body of a region ends
lc	Leading Context	offset past "leading context" of pattern

The {offset} can be:

s	start of the matched pattern
s+{nr}	start of the matched pattern plus {nr} chars to the right
s-{nr}	start of the matched pattern plus {nr} chars to the left
e	end of the matched pattern
e+{nr}	end of the matched pattern plus {nr} chars to the right
e-{nr}	end of the matched pattern plus {nr} chars to the left
{nr}	(for "lc" only): start matching {nr} chars right of the start

Examples: "ms=s+1", "hs=e-2", "lc=3".

Although all offsets are accepted after any pattern, they are not always
meaningful.  This table shows which offsets are actually used:

		    ms	 me   hs   he	rs   re	  lc ~
match item	    yes  yes  yes  yes	-    -	  yes
region item start   yes  -    yes  -	yes  -	  yes
region item skip    -	 yes  -    -	-    -	  yes
region item end     -	 yes  -    yes	-    yes  yes

Offsets can be concatenated, with a ',' in between.  Example: >
  :syn match String  /"[^"]*"/hs=s+1,he=e-1
<
    some "string" text
	  ^^^^^^		highlighted

Notes:
- There must be no white space between the pattern and

Title: Vim Syntax Highlighting: Implicit Conceal and Syntax Patterns
Summary
This section explains the use of `:syntax conceal [on|off]` to control whether subsequent syntax commands automatically set the "conceal" flag. It transitions to syntax patterns, describing how patterns are defined with delimiters and how Vim interprets them with 'magic' set and 'l' flag excluded from 'cpoptions'. It warns against patterns that match empty strings. It introduces character offsets (ms, me, hs, he, rs, re, lc) to adjust the highlighted portion or text area included in a match or region, relative to the matched pattern.