Home Explore Blog CI



neovim

5th chunk of `runtime/doc/spell.txt`
4adf2abfe94767044bfb3e1273111bd9b316c23be1bda7320000000100000fa4
 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 found (Polish doesn't make sense when leaving
out the non-ASCII characters).

A spell file might not be available in the current 'encoding'.  See
|spell-mkspell| about how to create a spell file.  Converting a spell file
with "iconv" will NOT work!

						    *spell-sug-file* *E781*
If there is a file with exactly the same name as the ".spl" file but ending in
".sug", that file will be used for giving better suggestions.  It isn't loaded
before suggestions are made to reduce memory use.

				    *E758* *E759* *E778* *E779* *E780* *E782*
When loading a spell file Vim checks that it is properly formatted.  If you
get an error the file may be truncated, modified or intended for another Vim
version.


SPELLFILE CLEANUP					*spellfile-cleanup*

The |zw| command turns existing entries in 'spellfile' into comment lines.
This avoids having to write a new file every time, but results in the file
only getting longer, never shorter.  To clean up the comment lines in all
".add" spell files do this: >
	:runtime spell/cleanadd.vim

This deletes all comment lines, except the ones that start with "##".  Use
"##" lines to add comments that you want to keep.

You can invoke this script as often as you like.  A variable is provided to
skip updating files that have been changed recently.  Set it to the number of
seconds that has passed since a file was changed before it will be cleaned.
For example, to clean only files that were not changed in the last hour: >
      let g:spell_clean_limit = 60 * 60
The default is one second.


WORDS

Vim uses a fixed method to recognize a word.  This is independent of
'iskeyword', so that it also works in help files and for languages that
include characters like '-' in 'iskeyword'.  The word characters do depend on
'encoding'.

The table with word characters is stored in the main .spl file.  Therefore it
matters what the current locale is when generating it!  A .add.spl file does
not contain a word table though.

For a word that starts with a digit the digit is ignored, unless the word as a
whole is recognized.  Thus if "3D" is a word and "D" is not then "3D" is
recognized as a word, but if "3D" is not a word then only the "D" is marked as
bad.  Hex numbers in the form 0x12ab and 0X12AB are recognized.


WORD COMBINATIONS

It is possible to spell-check words that include a space.  This is used to
recognize words that are invalid when used by themselves, e.g. for "et al.".
It can also be used to recognize "the the" and highlight it.

The number of spaces is irrelevant.  In most cases a line break may also
appear.  However, this makes it difficult to find out where to start checking
for spelling mistakes.  When you make a change to one line and only that line
is redrawn Vim won't look in the previous line, thus when "et" is at the end
of the previous line "al." will be flagged as an error.  And when you type
"the<CR>the" the highlighting doesn't appear until the first line is redrawn.
Use |CTRL-L| to redraw right away.  "[s" will also

Title: Vim Spell Checking: File Details, Cleanup, Word Recognition, and Word Combinations
Summary
This section continues the discussion of Vim spell checking, explaining that if a spell file isn't in the current 'encoding', conversion with "iconv" won't work; instead use |spell-mkspell|. It also details the use of `.sug` files for better suggestions. It addresses potential errors during spell file loading and provides instructions for cleaning up comment lines in `.add` files using `:runtime spell/cleanadd.vim`. Furthermore, it explains Vim's method for word recognition, independent of 'iskeyword' but dependent on 'encoding', and its ability to spell-check word combinations including spaces, such as "et al.", but acknowledges the challenges with line breaks and offers solutions like |CTRL-L|.