Home Explore Blog CI



neovim

47th chunk of `runtime/doc/syntax.txt`
deb3f0bc0e8769743ade3dca42d2925563b6cec701fb61cb0000000100000fa1
 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| and |:syn-fold|):

	start:		Use level of item containing start of line.
	minimum:	Use lowest local-minimum level of items on line.

	The default is "start".  Use "minimum" to search a line horizontally
	for the lowest level contained on the line that is followed by a
	higher level.  This produces more natural folds when syntax items
	may close and open horizontally within a line.

:sy[ntax] foldlevel
	Show the current foldlevel method, either "syntax foldlevel start" or
	"syntax foldlevel minimum".

SPELL CHECKING						*:syn-spell*

:sy[ntax] spell toplevel
:sy[ntax] spell notoplevel
:sy[ntax] spell default
	This defines where spell checking is to be done for text that is not
	in a syntax item:

	toplevel:	Text is spell checked.
	notoplevel:	Text is not spell checked.
	default:	When there is a @Spell cluster no spell checking.

	For text in syntax items use the @Spell and @NoSpell clusters
	|spell-syntax|.  When there is no @Spell and no @NoSpell cluster then
	spell checking is done for "default" and "toplevel".

	To activate spell checking the 'spell' option must be set.

:sy[ntax] spell
	Show the current syntax spell checking method, either "syntax spell
	toplevel", "syntax spell notoplevel" or "syntax spell default".


SYNTAX ISKEYWORD SETTING				*:syn-iskeyword*

:sy[ntax] iskeyword [clear | {option}]
	This defines the keyword characters.  It's like the 'iskeyword' option
	for but only applies to syntax highlighting.

	clear:		Syntax specific iskeyword setting is disabled and the
			buffer-local 'iskeyword' setting is used.
	{option}	Set the syntax 'iskeyword' option to a new value.

	Example: >
  :syntax iskeyword @,48-57,192-255,$,_
<
	This would set the syntax specific iskeyword option to include all
	alphabetic characters, plus the numeric characters, all accented
	characters and also includes the "_" and the "$".

	If no argument is given, the current value will be output.

	Setting this option influences what |/\k| matches in syntax patterns
	and also determines where |:syn-keyword| will be checked for a new
	match.

	It is recommended when writing syntax files, to use this command to
	set the correct value for the specific syntax language and not change
	the 'iskeyword' option.

DEFINING KEYWORDS					*:syn-keyword*

:sy[ntax] keyword {group-name} [{options}] {keyword} .. [{options}]

	This defines a number of keywords.

	{group-name}	Is a syntax group name such as "Comment".
	[{options}]	See |:syn-arguments| below.
	{keyword} ..	Is a list of keywords which are part of this group.

	Example: >
  :syntax keyword   Type   int long char
<
	The {options} can be given anywhere in the line.  They will apply to
	all keywords given, also for options that come after a keyword.
	These examples do exactly the same: >
  :syntax keyword   Type   contained int long char
  :syntax keyword   Type   int long contained char
  :syntax keyword   Type   int long char contained
<								*E789* *E890*
	When you have a keyword with an optional tail, like

Title: Vim Syntax: Priority, Case, Foldlevel, Spell Checking, Iskeyword, and Keywords
Summary
This section covers advanced syntax definition in Vim, including rules for resolving priority conflicts, defining case sensitivity, setting fold levels for syntax folding, enabling/disabling spell checking, setting syntax-specific keyword characters, and defining keywords with syntax groups and options. It provides commands and examples for each of these features.