Home Explore Blog CI



neovim

15th chunk of `runtime/doc/spell.txt`
02b63a6da0783ec0c5f67a4c0392f828d7c99714428c1afa0000000100000fa2
 characters. [^abc] matches any
		  character but a, b and c.

{extra}		Optional extra text:
		    # comment		Comment is ignored
		    -			Hunspell uses this, ignored

For PFX the fields are the same, but the {strip}, {add} and {condition} apply
to the start of the word.

Note: Myspell ignores any extra text after the relevant info.  Vim requires
this text to start with a "#" so that mistakes don't go unnoticed.  Example:

	SFX F 0 in   [^i]n      # Spion > Spionin  ~
	SFX F 0 nen  in		# Bauerin > Bauerinnen ~

However, to avoid lots of errors in affix files written for Myspell, you can
add the IGNOREEXTRA flag.

Apparently Myspell allows an affix name to appear more than once.  Since this
might also be a mistake, Vim checks for an extra "S".  The affix files for
Myspell that use this feature apparently have this flag.  Example:

	SFX a Y 1 S ~
	SFX a 0 an . ~

	SFX a Y 2 S ~
	SFX a 0 en . ~
	SFX a 0 on . ~


AFFIX FLAGS						*spell-affix-flags*

This is a feature that comes from Hunspell: The affix may specify flags.  This
works similar to flags specified on a basic word.  The flags apply to the
basic word plus the affix (but there are restrictions).  Example:

	SFX S Y 1 ~
	SFX S 0 s . ~

	SFX A Y 1 ~
	SFX A 0 able/S . ~

When the dictionary file contains "drink/AS" then these words are possible:

	drink
	drinks		uses S suffix
	drinkable	uses A suffix
	drinkables	uses A suffix and then S suffix

Generally the flags of the suffix are added to the flags of the basic word,
both are used for the word plus suffix.  But the flags of the basic word are
only used once for affixes, except that both one prefix and one suffix can be
used when both support combining.

Specifically, the affix flags can be used for:
- Suffixes on suffixes, as in the example above.  This works once, thus you
  can have two suffixes on a word (plus one prefix).
- Making the word with the affix rare, by using the |spell-RARE| flag.
- Exclude the word with the affix from compounding, by using the
  |spell-COMPOUNDFORBIDFLAG| flag.
- Allow the word with the affix to be part of a compound word on the side of
  the affix with the |spell-COMPOUNDPERMITFLAG|.
- Use the NEEDCOMPOUND flag: word plus affix can only be used as part of a
  compound word. |spell-NEEDCOMPOUND|
- Compound flags: word plus affix can be part of a compound word at the end,
  middle, start, etc.  The flags are combined with the flags of the basic
  word.  |spell-compound|
- NEEDAFFIX: another affix is needed to make a valid word.
- CIRCUMFIX, as explained just below.


IGNOREEXTRA						*spell-IGNOREEXTRA*

Normally Vim gives an error for an extra field that does not start with '#'.
This avoids errors going unnoticed.  However, some files created for Myspell
or Hunspell may contain many entries with an extra field.  Use the IGNOREEXTRA
flag to avoid lots of errors.


CIRCUMFIX						*spell-CIRCUMFIX*

The CIRCUMFIX flag means a prefix and suffix must be added at the same time.
If a prefix has the CIRCUMFIX flag then only suffixes with the CIRCUMFIX flag
can be added, and the other way around.
An alternative is to only specify the suffix, and give that suffix two flags:
the required prefix and the NEEDAFFIX flag.  |spell-NEEDAFFIX|


PFXPOSTPONE						*spell-PFXPOSTPONE*

When an affix file has very many prefixes that apply to many words it's not
possible to build the whole word list in memory.  This applies to Hebrew (a
list with all words is over a Gbyte).  In that case applying prefixes must be
postponed.  This makes spell checking slower.  It is indicated by this keyword
in the .aff file:

	PFXPOSTPONE ~

Only prefixes without a chop string and without flags can be postponed.
Prefixes with a chop string or with flags will still be included in the word
list.  An exception if the chop string is one character and equal to the last
character of the added string, but in lower case.  Thus when the chop string
is used to allow the following word to start with an upper case letter.


WORDS WITH A SLASH

Title: Affix Flags, IGNOREEXTRA, CIRCUMFIX, and PFXPOSTPONE
Summary
This section explains how to use affix flags with the basic word, and the various use cases for doing so, such as suffixes on suffixes, marking words as rare, controlling compounding behavior, and requiring other affixes. It then describes the `IGNOREEXTRA` flag, which disables errors for extra fields in affix files that do not start with '#'. The `CIRCUMFIX` flag is explained, indicating that a prefix and suffix must be added simultaneously. Finally, the `PFXPOSTPONE` keyword is introduced, which allows postponing the application of prefixes in memory to handle large word lists (like Hebrew), improving memory usage at the cost of spell-checking speed.