Home Explore Blog CI



neovim

46th chunk of `runtime/doc/syntax.txt`
cd9491d7b3060fc8ff8319a51f662816c20c7fc04d13cab00000000100000faa

plain scalar contents, treat plain scalar (which can actually be only string
and nothing else) as a value of the other type: null, boolean, floating-point,
integer. `g:yaml_schema` option determines according to which schema values
will be highlighted specially. Supported schemas are

Schema		Description ~
failsafe	No additional highlighting.
json		Supports JSON-style numbers, booleans and null.
core		Supports more number, boolean and null styles.
pyyaml		In addition to core schema supports highlighting timestamps,
		but there are some differences in what is recognized as
		numbers and many additional boolean values not present in core
		schema.

Default schema is `core`.

Note that schemas are not actually limited to plain scalars, but this is the
only difference between schemas defined in YAML specification and the only
difference defined in the syntax file.


ZSH						    *zsh.vim* *ft-zsh-syntax*

The syntax script for zsh allows for syntax-based folding: >

	:let g:zsh_fold_enable = 1

==============================================================================
6. Defining a syntax					*:syn-define* *E410*

Vim understands three types of syntax items:

1. Keyword
   It can only contain keyword characters, according to the characters
   specified with |:syn-iskeyword| or the 'iskeyword' option.  It cannot
   contain other syntax items.  It will only match with a complete word (there
   are no keyword characters before or after the match).  The keyword "if"
   would match in "if(a=b)", but not in "ifdef x", because "(" is not a
   keyword character and "d" is.

2. Match
   This is a match with a single regexp pattern.

3. Region
   This starts at a match of the "start" regexp pattern and ends with a match
   with the "end" regexp pattern.  Any other text can appear in between.  A
   "skip" regexp pattern can be used to avoid matching the "end" pattern.

Several syntax ITEMs can be put into one syntax GROUP.	For a syntax group
you can give highlighting attributes.  For example, you could have an item
to define a `/* .. */` comment and another one that defines a "// .." comment,
and put them both in the "Comment" group.  You can then specify that a
"Comment" will be in bold font and have a blue color.  You are free to make
one highlight group for one syntax item, or put all items into one group.
This depends on how you want to specify your highlighting attributes.  Putting
each item in its own group results in having to specify the highlighting
for a lot of groups.

Note that a syntax group and a highlight group are similar.  For a highlight
group you will have given highlight attributes.  These attributes will be used
for the syntax group with the same name.

In case more than one item matches at the same position, the one that was
defined LAST wins.  Thus you can override previously defined syntax items by
using an item that matches the same text.  But a keyword always goes before a
match or region.  And a keyword with matching case always goes before a
keyword with ignoring case.


PRIORITY						*:syn-priority*

When several syntax items may match, these rules are used:

1. When multiple Match or Region items start in the same position, the item
   defined last has priority.
2. A Keyword has priority over Match and Region items.
3. An item that starts in an earlier position has priority over items that
   start in later positions.


DEFINING CASE						*:syn-case* *E390*

:sy[ntax] case [match | ignore]
	This defines if the following ":syntax" commands will work with
	matching case, when using "match", or with ignoring case, when using
	"ignore".  Note that any items before this are not affected, and all
	items until the next ":syntax case" command are affected.

:sy[ntax] case
	Show either "syntax case match" or "syntax case ignore".


DEFINING FOLDLEVEL					*:syn-foldlevel*

:sy[ntax] foldlevel start
:sy[ntax] foldlevel minimum
	This defines how the foldlevel of a line is computed when using
	foldmethod=syntax (see |fold-syntax|

Title: YAML Schemas, ZSH Folding, and Defining Syntax Items in Vim
Summary
This section details YAML schema options for syntax highlighting, enabling ZSH syntax-based folding, and explains how to define syntax items (Keyword, Match, Region) in Vim for custom highlighting. It also covers syntax groups, priority rules for overlapping matches, case sensitivity (:syn-case), and defining fold levels (:syn-foldlevel) for syntax folding.