Home Explore Blog CI



neovim

4th chunk of `runtime/doc/spell.txt`
0d9747ff1a8cbc51ea35c768900711cce194aaa76f6159fa0000000100000fa1
 too.


REGIONS

A word may be spelled differently in various regions.  For example, English
comes in (at least) these variants:

	en		all regions
	en_au		Australia
	en_ca		Canada
	en_gb		Great Britain
	en_nz		New Zealand
	en_us		USA

Words that are not used in one region but are used in another region are
highlighted with SpellLocal |hl-SpellLocal|.

Always use lowercase letters for the language and region names.

When adding a word with |zg| or another command it's always added for all
regions.  You can change that by manually editing the 'spellfile'.  See
|spell-wordlist-format|.  Note that the regions as specified in the files in
'spellfile' are only used when all entries in 'spelllang' specify the same
region (not counting files specified by their .spl name).

							*spell-german*
Specific exception: For German these special regions are used:
	de		all German words accepted
	de_de		old and new spelling
	de_19		old spelling
	de_20		new spelling
	de_at		Austria
	de_ch		Switzerland

							*spell-russian*
Specific exception: For Russian these special regions are used:
	ru		all Russian words accepted
	ru_ru		"IE" letter spelling
	ru_yo		"YO" letter spelling

							*spell-yiddish*
Yiddish requires using "utf-8" encoding, because of the special characters
used.  If you are using latin1 Vim will use transliterated (romanized) Yiddish
instead.  If you want to use transliterated Yiddish with utf-8 use "yi-tr".
In a table:
	'encoding'	'spelllang'
	utf-8		yi		Yiddish
	latin1		yi		transliterated Yiddish
	utf-8		yi-tr		transliterated Yiddish

							*spell-cjk*
Chinese, Japanese and other East Asian characters are normally marked as
errors, because spell checking of these characters is not supported. If
'spelllang' includes "cjk", these characters are not marked as errors.  This
is useful when editing text with spell checking while some Asian words are
present.


SPELL FILES						*spell-load*

Vim searches for spell files in the "spell" subdirectory of the directories in
'runtimepath'.  The name is: LL.EEE.spl, where:
	LL	the language name
	EEE	the value of 'encoding'

The value for "LL" comes from 'spelllang', but excludes the region name.
Examples:
	'spelllang'	LL ~
	en_us		en
	en-rare		en-rare
	medical_ca	medical

Only the first file is loaded, the one that is first in 'runtimepath'.  If
this succeeds then additionally files with the name LL.EEE.add.spl are loaded.
All the ones that are found are used.

If no spell file is found the |SpellFileMissing| autocommand event is
triggered.  This may trigger the |spellfile.vim| plugin to offer you
downloading the spell file.

Additionally, the files related to the names in 'spellfile' are loaded.  These
are the files that |zg| and |zw| add good and wrong words to.

Exceptions:
- Vim uses "latin1" when 'encoding' is "iso-8859-15".  The euro sign doesn't
  matter for spelling.
- When no spell file for 'encoding' is found "ascii" is tried.  This only
  works for languages where nearly all words are ASCII, such as English.  It
  helps when 'encoding' is not "latin1", such as iso-8859-2, and English text
  is being edited.  For the ".add" files the same name as the found main
  spell file is used.

For example, with these values:
	'runtimepath' is "~/.config/nvim,/usr/share/nvim/runtime/,~/.config/nvim/after"
	'encoding'    is "iso-8859-2"
	'spelllang'   is "pl"

Vim will look for:
1. ~/.config/nvim/spell/pl.iso-8859-2.spl
2. /usr/share/nvim/runtime/spell/pl.iso-8859-2.spl
3. ~/.config/nvim/spell/pl.iso-8859-2.add.spl
4. /usr/share/nvim/runtime/spell/pl.iso-8859-2.add.spl
5. ~/.config/nvim/after/spell/pl.iso-8859-2.add.spl

This assumes 1. is not found and 2. is found.

If 'encoding' is "latin1" Vim will look for:
1. ~/.config/nvim/spell/pl.latin1.spl
2. /usr/share/nvim/runtime/spell/pl.latin1.spl
3. ~/.config/nvim/after/spell/pl.latin1.spl
4. ~/.config/nvim/spell/pl.ascii.spl
5. /usr/share/nvim/runtime/spell/pl.ascii.spl
6. ~/.config/nvim/after/spell/pl.ascii.spl

This assumes none of them are

Title: Vim Spell Checking: Regional Variations, Special Languages, and File Loading
Summary
This section expands on spell checking in Vim, focusing on regional variations for languages like English, German, and Russian. It also discusses considerations for Yiddish, requiring UTF-8 encoding, and how Chinese, Japanese, and Korean characters are handled. It details the process of how Vim locates and loads spell files based on 'runtimepath', 'encoding', and 'spelllang', including the use of `.spl` and `.add.spl` files, and the SpellFileMissing event triggered when no spell file is found.