xref: /vim-8.2.3635/runtime/doc/spell.txt (revision 12ee7ff0)
1*spell.txt*	For Vim version 8.1.  Last change: 2019 May 05
2
3
4		  VIM REFERENCE MANUAL	  by Bram Moolenaar
5
6
7Spell checking						*spell*
8
91. Quick start			|spell-quickstart|
102. Remarks on spell checking	|spell-remarks|
113. Generating a spell file	|spell-mkspell|
124. Spell file format		|spell-file-format|
13
14{not available when the |+syntax| feature has been disabled at compile time}
15
16Note: There also is a vimspell plugin.  If you have it you can do ":help
17vimspell" to find about it.  But you will probably want to get rid of the
18plugin and use the 'spell' option instead, it works better.
19
20==============================================================================
211. Quick start					*spell-quickstart* *E756*
22
23This command switches on spell checking: >
24
25	:setlocal spell spelllang=en_us
26
27This switches on the 'spell' option and specifies to check for US English.
28
29The words that are not recognized are highlighted with one of these:
30	SpellBad	word not recognized			|hl-SpellBad|
31	SpellCap	word not capitalised			|hl-SpellCap|
32	SpellRare	rare word				|hl-SpellRare|
33	SpellLocal	wrong spelling for selected region	|hl-SpellLocal|
34
35Vim only checks words for spelling, there is no grammar check.
36
37If the 'mousemodel' option is set to "popup" and the cursor is on a badly
38spelled word or it is "popup_setpos" and the mouse pointer is on a badly
39spelled word, then the popup menu will contain a submenu to replace the bad
40word.  Note: this slows down the appearance of the popup menu.  Note for GTK:
41don't release the right mouse button until the menu appears, otherwise it
42won't work.
43
44To search for the next misspelled word:
45
46							*]s*
47]s			Move to next misspelled word after the cursor.
48			A count before the command can be used to repeat.
49			'wrapscan' applies.
50
51							*[s*
52[s			Like "]s" but search backwards, find the misspelled
53			word before the cursor.  Doesn't recognize words
54			split over two lines, thus may stop at words that are
55			not highlighted as bad.  Does not stop at word with
56			missing capital at the start of a line.
57
58							*]S*
59]S			Like "]s" but only stop at bad words, not at rare
60			words or words for another region.
61
62							*[S*
63[S			Like "]S" but search backwards.
64
65
66To add words to your own word list:
67
68							*zg*
69zg			Add word under the cursor as a good word to the first
70			name in 'spellfile'.  A count may precede the command
71			to indicate the entry in 'spellfile' to be used.  A
72			count of two uses the second entry.
73
74			In Visual mode the selected characters are added as a
75			word (including white space!).
76			When the cursor is on text that is marked as badly
77			spelled then the marked text is used.
78			Otherwise the word under the cursor, separated by
79			non-word characters, is used.
80
81			If the word is explicitly marked as bad word in
82			another spell file the result is unpredictable.
83
84							*zG*
85zG			Like "zg" but add the word to the internal word list
86			|internal-wordlist|.
87
88							*zw*
89zw			Like "zg" but mark the word as a wrong (bad) word.
90			If the word already appears in 'spellfile' it is
91			turned into a comment line.  See |spellfile-cleanup|
92			for getting rid of those.
93
94							*zW*
95zW			Like "zw" but add the word to the internal word list
96			|internal-wordlist|.
97
98zuw							*zug* *zuw*
99zug			Undo |zw| and |zg|, remove the word from the entry in
100			'spellfile'.  Count used as with |zg|.
101
102zuW							*zuG* *zuW*
103zuG			Undo |zW| and |zG|, remove the word from the internal
104			word list.  Count used as with |zg|.
105
106							*:spe* *:spellgood*
107:[count]spe[llgood] {word}
108			Add {word} as a good word to 'spellfile', like with
109			|zg|.  Without count the first name is used, with a
110			count of two the second entry, etc.
111
112:spe[llgood]! {word}	Add {word} as a good word to the internal word list,
113			like with |zG|.
114
115							*:spellw* *:spellwrong*
116:[count]spellw[rong] {word}
117			Add {word} as a wrong (bad) word to 'spellfile', as
118			with |zw|.  Without count the first name is used, with
119			a count of two the second entry, etc.
120
121:spellw[rong]! {word}	Add {word} as a wrong (bad) word to the internal word
122			list, like with |zW|.
123
124:[count]spellu[ndo] {word}				*:spellu* *:spellundo*
125			Like |zuw|.  [count] used as with |:spellgood|.
126
127:spellu[ndo]! {word}	Like |zuW|.  [count] used as with |:spellgood|.
128
129
130After adding a word to 'spellfile' with the above commands its associated
131".spl" file will automatically be updated and reloaded.  If you change
132'spellfile' manually you need to use the |:mkspell| command.  This sequence of
133commands mostly works well: >
134	:edit <file in 'spellfile'>
135<	(make changes to the spell file) >
136	:mkspell! %
137
138More details about the 'spellfile' format below |spell-wordlist-format|.
139
140							*internal-wordlist*
141The internal word list is used for all buffers where 'spell' is set.  It is
142not stored, it is lost when you exit Vim.  It is also cleared when 'encoding'
143is set.
144
145
146Finding suggestions for bad words:
147							*z=*
148z=			For the word under/after the cursor suggest correctly
149			spelled words.  This also works to find alternatives
150			for a word that is not highlighted as a bad word,
151			e.g., when the word after it is bad.
152			In Visual mode the highlighted text is taken as the
153			word to be replaced.
154			The results are sorted on similarity to the word being
155			replaced.
156			This may take a long time.  Hit CTRL-C when you get
157			bored.
158
159			If the command is used without a count the
160			alternatives are listed and you can enter the number
161			of your choice or press <Enter> if you don't want to
162			replace.  You can also use the mouse to click on your
163			choice (only works if the mouse can be used in Normal
164			mode and when there are no line wraps).  Click on the
165			first line (the header) to cancel.
166
167			The suggestions listed normally replace a highlighted
168			bad word.  Sometimes they include other text, in that
169			case the replaced text is also listed after a "<".
170
171			If a count is used that suggestion is used, without
172			prompting.  For example, "1z=" always takes the first
173			suggestion.
174
175			If 'verbose' is non-zero a score will be displayed
176			with the suggestions to indicate the likeliness to the
177			badly spelled word (the higher the score the more
178			different).
179			When a word was replaced the redo command "." will
180			repeat the word replacement.  This works like "ciw",
181			the good word and <Esc>.  This does NOT work for Thai
182			and other languages without spaces between words.
183
184					*:spellr* *:spellrepall* *E752* *E753*
185:spellr[epall]		Repeat the replacement done by |z=| for all matches
186			with the replaced word in the current window.
187
188In Insert mode, when the cursor is after a badly spelled word, you can use
189CTRL-X s to find suggestions.  This works like Insert mode completion.  Use
190CTRL-N to use the next suggestion, CTRL-P to go back. |i_CTRL-X_s|
191
192The 'spellsuggest' option influences how the list of suggestions is generated
193and sorted.  See |'spellsuggest'|.
194
195The 'spellcapcheck' option is used to check the first word of a sentence
196starts with a capital.  This doesn't work for the first word in the file.
197When there is a line break right after a sentence the highlighting of the next
198line may be postponed.  Use |CTRL-L| when needed.  Also see |set-spc-auto| for
199how it can be set automatically when 'spelllang' is set.
200
201Vim counts the number of times a good word is encountered.  This is used to
202sort the suggestions: words that have been seen before get a small bonus,
203words that have been seen often get a bigger bonus.  The COMMON item in the
204affix file can be used to define common words, so that this mechanism also
205works in a new or short file |spell-COMMON|.
206
207==============================================================================
2082. Remarks on spell checking				*spell-remarks*
209
210PERFORMANCE
211
212Vim does on-the-fly spell checking.  To make this work fast the word list is
213loaded in memory.  Thus this uses a lot of memory (1 Mbyte or more).  There
214might also be a noticeable delay when the word list is loaded, which happens
215when 'spell' is set and when 'spelllang' is set while 'spell' was already set.
216To minimize the delay each word list is only loaded once, it is not deleted
217when 'spelllang' is made empty or 'spell' is reset.  When 'encoding' is set
218all the word lists are reloaded, thus you may notice a delay then too.
219
220
221REGIONS
222
223A word may be spelled differently in various regions.  For example, English
224comes in (at least) these variants:
225
226	en		all regions
227	en_au		Australia
228	en_ca		Canada
229	en_gb		Great Britain
230	en_nz		New Zealand
231	en_us		USA
232
233Words that are not used in one region but are used in another region are
234highlighted with SpellLocal |hl-SpellLocal|.
235
236Always use lowercase letters for the language and region names.
237
238When adding a word with |zg| or another command it's always added for all
239regions.  You can change that by manually editing the 'spellfile'.  See
240|spell-wordlist-format|.  Note that the regions as specified in the files in
241'spellfile' are only used when all entries in 'spelllang' specify the same
242region (not counting files specified by their .spl name).
243
244							*spell-german*
245Specific exception: For German these special regions are used:
246	de		all German words accepted
247	de_de		old and new spelling
248	de_19		old spelling
249	de_20		new spelling
250	de_at		Austria
251	de_ch		Switzerland
252
253							*spell-russian*
254Specific exception: For Russian these special regions are used:
255	ru		all Russian words accepted
256	ru_ru		"IE" letter spelling
257	ru_yo		"YO" letter spelling
258
259							*spell-yiddish*
260Yiddish requires using "utf-8" encoding, because of the special characters
261used.  If you are using latin1 Vim will use transliterated (romanized) Yiddish
262instead.  If you want to use transliterated Yiddish with utf-8 use "yi-tr".
263In a table:
264	'encoding'	'spelllang'
265	utf-8		yi		Yiddish
266	latin1		yi		transliterated Yiddish
267	utf-8		yi-tr		transliterated Yiddish
268
269							*spell-cjk*
270Chinese, Japanese and other East Asian characters are normally marked as
271errors, because spell checking of these characters is not supported. If
272'spelllang' includes "cjk", these characters are not marked as errors.  This
273is useful when editing text with spell checking while some Asian words are
274present.
275
276
277SPELL FILES						*spell-load*
278
279Vim searches for spell files in the "spell" subdirectory of the directories in
280'runtimepath'.  The name is: LL.EEE.spl, where:
281	LL	the language name
282	EEE	the value of 'encoding'
283
284The value for "LL" comes from 'spelllang', but excludes the region name.
285Examples:
286	'spelllang'	LL ~
287	en_us		en
288	en-rare		en-rare
289	medical_ca	medical
290
291Only the first file is loaded, the one that is first in 'runtimepath'.  If
292this succeeds then additionally files with the name LL.EEE.add.spl are loaded.
293All the ones that are found are used.
294
295If no spell file is found the |SpellFileMissing| autocommand event is
296triggered.  This may trigger the |spellfile.vim| plugin to offer you
297downloading the spell file.
298
299Additionally, the files related to the names in 'spellfile' are loaded.  These
300are the files that |zg| and |zw| add good and wrong words to.
301
302Exceptions:
303- Vim uses "latin1" when 'encoding' is "iso-8859-15".  The euro sign doesn't
304  matter for spelling.
305- When no spell file for 'encoding' is found "ascii" is tried.  This only
306  works for languages where nearly all words are ASCII, such as English.  It
307  helps when 'encoding' is not "latin1", such as iso-8859-2, and English text
308  is being edited.  For the ".add" files the same name as the found main
309  spell file is used.
310
311For example, with these values:
312	'runtimepath' is "~/.vim,/usr/share/vim81,~/.vim/after"
313	'encoding'    is "iso-8859-2"
314	'spelllang'   is "pl"
315
316Vim will look for:
3171. ~/.vim/spell/pl.iso-8859-2.spl
3182. /usr/share/vim81/spell/pl.iso-8859-2.spl
3193. ~/.vim/spell/pl.iso-8859-2.add.spl
3204. /usr/share/vim81/spell/pl.iso-8859-2.add.spl
3215. ~/.vim/after/spell/pl.iso-8859-2.add.spl
322
323This assumes 1. is not found and 2. is found.
324
325If 'encoding' is "latin1" Vim will look for:
3261. ~/.vim/spell/pl.latin1.spl
3272. /usr/share/vim81/spell/pl.latin1.spl
3283. ~/.vim/after/spell/pl.latin1.spl
3294. ~/.vim/spell/pl.ascii.spl
3305. /usr/share/vim81/spell/pl.ascii.spl
3316. ~/.vim/after/spell/pl.ascii.spl
332
333This assumes none of them are found (Polish doesn't make sense when leaving
334out the non-ASCII characters).
335
336Spelling for EBCDIC is currently not supported.
337
338A spell file might not be available in the current 'encoding'.  See
339|spell-mkspell| about how to create a spell file.  Converting a spell file
340with "iconv" will NOT work!
341
342Note: on VMS ".{enc}.spl" is changed to "_{enc}.spl" to avoid trouble with
343filenames.
344
345						    *spell-sug-file* *E781*
346If there is a file with exactly the same name as the ".spl" file but ending in
347".sug", that file will be used for giving better suggestions.  It isn't loaded
348before suggestions are made to reduce memory use.
349
350				    *E758* *E759* *E778* *E779* *E780* *E782*
351When loading a spell file Vim checks that it is properly formatted.  If you
352get an error the file may be truncated, modified or intended for another Vim
353version.
354
355
356SPELLFILE CLEANUP					*spellfile-cleanup*
357
358The |zw| command turns existing entries in 'spellfile' into comment lines.
359This avoids having to write a new file every time, but results in the file
360only getting longer, never shorter.  To clean up the comment lines in all
361".add" spell files do this: >
362	:runtime spell/cleanadd.vim
363
364This deletes all comment lines, except the ones that start with "##".  Use
365"##" lines to add comments that you want to keep.
366
367You can invoke this script as often as you like.  A variable is provided to
368skip updating files that have been changed recently.  Set it to the number of
369seconds that has passed since a file was changed before it will be cleaned.
370For example, to clean only files that were not changed in the last hour: >
371      let g:spell_clean_limit = 60 * 60
372The default is one second.
373
374
375WORDS
376
377Vim uses a fixed method to recognize a word.  This is independent of
378'iskeyword', so that it also works in help files and for languages that
379include characters like '-' in 'iskeyword'.  The word characters do depend on
380'encoding'.
381
382The table with word characters is stored in the main .spl file.  Therefore it
383matters what the current locale is when generating it!  A .add.spl file does
384not contain a word table though.
385
386For a word that starts with a digit the digit is ignored, unless the word as a
387whole is recognized.  Thus if "3D" is a word and "D" is not then "3D" is
388recognized as a word, but if "3D" is not a word then only the "D" is marked as
389bad.  Hex numbers in the form 0x12ab and 0X12AB are recognized.
390
391
392WORD COMBINATIONS
393
394It is possible to spell-check words that include a space.  This is used to
395recognize words that are invalid when used by themselves, e.g. for "et al.".
396It can also be used to recognize "the the" and highlight it.
397
398The number of spaces is irrelevant.  In most cases a line break may also
399appear.  However, this makes it difficult to find out where to start checking
400for spelling mistakes.  When you make a change to one line and only that line
401is redrawn Vim won't look in the previous line, thus when "et" is at the end
402of the previous line "al." will be flagged as an error.  And when you type
403"the<CR>the" the highlighting doesn't appear until the first line is redrawn.
404Use |CTRL-L| to redraw right away.  "[s" will also stop at a word combination
405with a line break.
406
407When encountering a line break Vim skips characters such as '*', '>' and '"',
408so that comments in C, shell and Vim code can be spell checked.
409
410
411SYNTAX HIGHLIGHTING					*spell-syntax*
412
413Files that use syntax highlighting can specify where spell checking should be
414done:
415
4161.  everywhere			   default
4172.  in specific items		   use "contains=@Spell"
4183.  everywhere but specific items  use "contains=@NoSpell"
419
420For the second method adding the @NoSpell cluster will disable spell checking
421again.  This can be used, for example, to add @Spell to the comments of a
422program, and add @NoSpell for items that shouldn't be checked.
423Also see |:syn-spell| for text that is not in a syntax item.
424
425
426VIM SCRIPTS
427
428If you want to write a Vim script that does something with spelling, you may
429find these functions useful:
430
431    spellbadword()	find badly spelled word at the cursor
432    spellsuggest()	get list of spelling suggestions
433    soundfold()		get the sound-a-like version of a word
434
435
436SETTING 'spellcapcheck' AUTOMATICALLY			*set-spc-auto*
437
438After the 'spelllang' option has been set successfully, Vim will source the
439files "spell/LANG.vim" in 'runtimepath'.  "LANG" is the value of 'spelllang'
440up to the first comma, dot or underscore.  This can be used to set options
441specifically for the language, especially 'spellcapcheck'.
442
443The distribution includes a few of these files.  Use this command to see what
444they do: >
445	:next $VIMRUNTIME/spell/*.vim
446
447Note that the default scripts don't set 'spellcapcheck' if it was changed from
448the default value.  This assumes the user prefers another value then.
449
450
451DOUBLE SCORING						*spell-double-scoring*
452
453The 'spellsuggest' option can be used to select "double" scoring.  This
454mechanism is based on the principle that there are two kinds of spelling
455mistakes:
456
4571. You know how to spell the word, but mistype something.  This results in a
458   small editing distance (character swapped/omitted/inserted) and possibly a
459   word that sounds completely different.
460
4612. You don't know how to spell the word and type something that sounds right.
462   The edit distance can be big but the word is similar after sound-folding.
463
464Since scores for these two mistakes will be very different we use a list
465for each and mix them.
466
467The sound-folding is slow and people that know the language won't make the
468second kind of mistakes.  Therefore 'spellsuggest' can be set to select the
469preferred method for scoring the suggestions.
470
471==============================================================================
4723. Generating a spell file				*spell-mkspell*
473
474Vim uses a binary file format for spelling.  This greatly speeds up loading
475the word list and keeps it small.
476						    *.aff* *.dic* *Myspell*
477You can create a Vim spell file from the .aff and .dic files that Myspell
478uses.  Myspell is used by OpenOffice.org and Mozilla. The OpenOffice .oxt
479files are zip files which contain the .aff and .dic files. You should be able
480to find them here:
481	http://extensions.services.openoffice.org/dictionary
482The older, OpenOffice 2 files may be used if this doesn't work:
483	http://wiki.services.openoffice.org/wiki/Dictionaries
484You can also use a plain word list.  The results are the same, the choice
485depends on what word lists you can find.
486
487If you install Aap (from www.a-a-p.org) you can use the recipes in the
488runtime/spell/??/ directories.  Aap will take care of downloading the files,
489apply patches needed for Vim and build the .spl file.
490
491Make sure your current locale is set properly, otherwise Vim doesn't know what
492characters are upper/lower case letters.  If the locale isn't available (e.g.,
493when using an MS-Windows codepage on Unix) add tables to the .aff file
494|spell-affix-chars|.  If the .aff file doesn't define a table then the word
495table of the currently active spelling is used.  If spelling is not active
496then Vim will try to guess.
497
498							*:mksp* *:mkspell*
499:mksp[ell][!] [-ascii] {outname} {inname} ...
500			Generate a Vim spell file from word lists.  Example: >
501		:mkspell /tmp/nl nl_NL.words
502<								*E751*
503			When {outname} ends in ".spl" it is used as the output
504			file name.  Otherwise it should be a language name,
505			such as "en", without the region name.  The file
506			written will be "{outname}.{encoding}.spl", where
507			{encoding} is the value of the 'encoding' option.
508
509			When the output file already exists [!] must be used
510			to overwrite it.
511
512			When the [-ascii] argument is present, words with
513			non-ascii characters are skipped.  The resulting file
514			ends in "ascii.spl".
515
516			The input can be the Myspell format files {inname}.aff
517			and {inname}.dic.  If {inname}.aff does not exist then
518			{inname} is used as the file name of a plain word
519			list.
520
521			Multiple {inname} arguments can be given to combine
522			regions into one Vim spell file.  Example: >
523		:mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU
524<			This combines the English word lists for US, CA and AU
525			into one en.spl file.
526			Up to eight regions can be combined. *E754* *E755*
527			The REP and SAL items of the first .aff file where
528			they appear are used. |spell-REP| |spell-SAL|
529								*E845*
530			This command uses a lot of memory, required to find
531			the optimal word tree (Polish, Italian and Hungarian
532			require several hundred Mbyte).  The final result will
533			be much smaller, because compression is used.  To
534			avoid running out of memory compression will be done
535			now and then.  This can be tuned with the 'mkspellmem'
536			option.
537
538			After the spell file was written and it was being used
539			in a buffer it will be reloaded automatically.
540
541:mksp[ell] [-ascii] {name}.{enc}.add
542			Like ":mkspell" above, using {name}.{enc}.add as the
543			input file and producing an output file in the same
544			directory that has ".spl" appended.
545
546:mksp[ell] [-ascii] {name}
547			Like ":mkspell" above, using {name} as the input file
548			and producing an output file in the same directory
549			that has ".{enc}.spl" appended.
550
551Vim will report the number of duplicate words.  This might be a mistake in the
552list of words.  But sometimes it is used to have different prefixes and
553suffixes for the same basic word to avoid them combining (e.g. Czech uses
554this).  If you want Vim to report all duplicate words set the 'verbose'
555option.
556
557Since you might want to change a Myspell word list for use with Vim the
558following procedure is recommended:
559
5601. Obtain the xx_YY.aff and xx_YY.dic files from Myspell.
5612. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic.
5623. Change the xx_YY.aff and xx_YY.dic files to remove bad words, add missing
563   words, define word characters with FOL/LOW/UPP, etc.  The distributed
564   "*.diff" files can be used.
5654. Start Vim with the right locale and use |:mkspell| to generate the Vim
566   spell file.
5675. Try out the spell file with ":set spell spelllang=xx" if you wrote it in
568   a spell directory in 'runtimepath', or ":set spelllang=xx.enc.spl" if you
569   wrote it somewhere else.
570
571When the Myspell files are updated you can merge the differences:
5721. Obtain the new Myspell files as xx_YY.new.aff and xx_UU.new.dic.
5732. Use Vimdiff to see what changed: >
574	vimdiff xx_YY.orig.dic xx_YY.new.dic
5753. Take over the changes you like in xx_YY.dic.
576   You may also need to change xx_YY.aff.
5774. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.orig.aff.
578
579
580SPELL FILE VERSIONS					*E770* *E771* *E772*
581
582Spell checking is a relatively new feature in Vim, thus it's possible that the
583.spl file format will be changed to support more languages.  Vim will check
584the validity of the spell file and report anything wrong.
585
586	E771: Old spell file, needs to be updated ~
587This spell file is older than your Vim.  You need to update the .spl file.
588
589	E772: Spell file is for newer version of Vim ~
590This means the spell file was made for a later version of Vim.  You need to
591update Vim.
592
593	E770: Unsupported section in spell file ~
594This means the spell file was made for a later version of Vim and contains a
595section that is required for the spell file to work.  In this case it's
596probably a good idea to upgrade your Vim.
597
598
599SPELL FILE DUMP
600
601If for some reason you want to check what words are supported by the currently
602used spelling files, use this command:
603
604							*:spelldump* *:spelld*
605:spelld[ump]		Open a new window and fill it with all currently valid
606			words.  Compound words are not included.
607			Note: For some languages the result may be enormous,
608			causing Vim to run out of memory.
609
610:spelld[ump]!		Like ":spelldump" and include the word count.  This is
611			the number of times the word was found while
612			updating the screen.  Words that are in COMMON items
613			get a starting count of 10.
614
615The format of the word list is used |spell-wordlist-format|.  You should be
616able to read it with ":mkspell" to generate one .spl file that includes all
617the words.
618
619When all entries to 'spelllang' use the same regions or no regions at all then
620the region information is included in the dumped words.  Otherwise only words
621for the current region are included and no "/regions" line is generated.
622
623Comment lines with the name of the .spl file are used as a header above the
624words that were generated from that .spl file.
625
626
627SPELL FILE MISSING		*spell-SpellFileMissing* *spellfile.vim*
628
629If the spell file for the language you are using is not available, you will
630get an error message.  But if the "spellfile.vim" plugin is active it will
631offer you to download the spell file.  Just follow the instructions, it will
632ask you where to write the file (there must be a writable directory in
633'runtimepath' for this).
634
635The plugin has a default place where to look for spell files, on the Vim ftp
636server.  If you want to use another location or another protocol, set the
637g:spellfile_URL variable to the directory that holds the spell files.  The
638|netrw| plugin is used for getting the file, look there for the specific
639syntax of the URL.  Example: >
640	let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
641You may need to escape special characters.
642
643The plugin will only ask about downloading a language once.  If you want to
644try again anyway restart Vim, or set g:spellfile_URL to another value (e.g.,
645prepend a space).
646
647To avoid using the "spellfile.vim" plugin do this in your vimrc file: >
648
649	let loaded_spellfile_plugin = 1
650
651Instead of using the plugin you can define a |SpellFileMissing| autocommand to
652handle the missing file yourself.  You can use it like this: >
653
654	:au SpellFileMissing * call Download_spell_file(expand('<amatch>'))
655
656Thus the <amatch> item contains the name of the language.  Another important
657value is 'encoding', since every encoding has its own spell file.  With two
658exceptions:
659- For ISO-8859-15 (latin9) the name "latin1" is used (the encodings only
660  differ in characters not used in dictionary words).
661- The name "ascii" may also be used for some languages where the words use
662  only ASCII letters for most of the words.
663
664The default "spellfile.vim" plugin uses this autocommand, if you define your
665autocommand afterwards you may want to use ":au! SpellFileMissing" to overrule
666it.  If you define your autocommand before the plugin is loaded it will notice
667this and not do anything.
668							*E797*
669Note that the SpellFileMissing autocommand must not change or destroy the
670buffer the user was editing.
671
672==============================================================================
6734. Spell file format					*spell-file-format*
674
675This is the format of the files that are used by the person who creates and
676maintains a word list.
677
678Note that we avoid the word "dictionary" here.  That is because the goal of
679spell checking differs from writing a dictionary (as in the book).  For
680spelling we need a list of words that are OK, thus should not be highlighted.
681Person and company names will not appear in a dictionary, but do appear in a
682word list.  And some old words are rarely used while they are common
683misspellings.  These do appear in a dictionary but not in a word list.
684
685There are two formats: A straight list of words and a list using affix
686compression.  The files with affix compression are used by Myspell (Mozilla
687and OpenOffice.org).  This requires two files, one with .aff and one with .dic
688extension.
689
690
691FORMAT OF STRAIGHT WORD LIST				*spell-wordlist-format*
692
693The words must appear one per line.  That is all that is required.
694
695Additionally the following items are recognized:
696
697- Empty and blank lines are ignored.
698
699	# comment ~
700- Lines starting with a # are ignored (comment lines).
701
702	/encoding=utf-8 ~
703- A line starting with "/encoding=", before any word, specifies the encoding
704  of the file.  After the second '=' comes an encoding name.  This tells Vim
705  to setup conversion from the specified encoding to 'encoding'.  Thus you can
706  use one word list for several target encodings.
707
708	/regions=usca ~
709- A line starting with "/regions=" specifies the region names that are
710  supported.  Each region name must be two ASCII letters.  The first one is
711  region 1.  Thus "/regions=usca" has region 1 "us" and region 2 "ca".
712  In an addition word list the region names should be equal to the main word
713  list!
714
715- Other lines starting with '/' are reserved for future use.  The ones that
716  are not recognized are ignored.  You do get a warning message, so that you
717  know something won't work.
718
719- A "/" may follow the word with the following items:
720    =		Case must match exactly.
721    ?		Rare word.
722    !		Bad (wrong) word.
723    1 to 9	A region in which the word is valid.  If no regions are
724		specified the word is valid in all regions.
725
726Example:
727
728	# This is an example word list		comment
729	/encoding=latin1			encoding of the file
730	/regions=uscagb				regions "us", "ca" and "gb"
731	example					word for all regions
732	blah/12					word for regions "us" and "ca"
733	vim/!					bad word
734	Campbell/?3				rare word in region 3 "gb"
735	's mornings/=				keep-case word
736
737Note that when "/=" is used the same word with all upper-case letters is not
738accepted.  This is different from a word with mixed case that is automatically
739marked as keep-case, those words may appear in all upper-case letters.
740
741
742FORMAT WITH .AFF AND .DIC FILES				*aff-dic-format*
743
744There are two files: the basic word list and an affix file.  The affix file
745specifies settings for the language and can contain affixes.  The affixes are
746used to modify the basic words to get the full word list.  This significantly
747reduces the number of words, especially for a language like Polish.  This is
748called affix compression.
749
750The basic word list and the affix file are combined with the ":mkspell"
751command and results in a binary spell file.  All the preprocessing has been
752done, thus this file loads fast.  The binary spell file format is described in
753the source code (src/spell.c).  But only developers need to know about it.
754
755The preprocessing also allows us to take the Myspell language files and modify
756them before the Vim word list is made.  The tools for this can be found in the
757"src/spell" directory.
758
759The format for the affix and word list files is based on what Myspell uses
760(the spell checker of Mozilla and OpenOffice.org).  A description can be found
761here:
762	http://lingucomponent.openoffice.org/affix.readme ~
763Note that affixes are case sensitive, this isn't obvious from the description.
764
765Vim supports quite a few extras.  They are described below |spell-affix-vim|.
766Attempts have been made to keep this compatible with other spell checkers, so
767that the same files can often be used.  One other project that offers more
768than Myspell is Hunspell ( http://hunspell.sf.net ).
769
770
771WORD LIST FORMAT				*spell-dic-format*
772
773A short example, with line numbers:
774
775	1	1234 ~
776	2	aan ~
777	3	Als ~
778	4	Etten-Leur ~
779	5	et al. ~
780	6	's-Gravenhage ~
781	7	's-Gravenhaags ~
782	8	# word that differs between regions ~
783	9	kado/1 ~
784	10	cadeau/2 ~
785	11	TCP,IP ~
786	12	/the S affix may add a 's' ~
787	13	bedel/S ~
788
789The first line contains the number of words.  Vim ignores it, but you do get
790an error message if it's not there.  *E760*
791
792What follows is one word per line.  White space at the end of the line is
793ignored, all other white space matters.  The encoding is specified in the
794affix file |spell-SET|.
795
796Comment lines start with '#' or '/'.  See the example lines 8 and 12.  Note
797that putting a comment after a word is NOT allowed:
798
799		someword   # comment that causes an error! ~
800
801After the word there is an optional slash and flags.  Most of these flags are
802letters that indicate the affixes that can be used with this word.  These are
803specified with SFX and PFX lines in the .aff file, see |spell-SFX| and
804|spell-PFX|.  Vim allows using other flag types with the FLAG item in the
805affix file |spell-FLAG|.
806
807When the word only has lower-case letters it will also match with the word
808starting with an upper-case letter.
809
810When the word includes an upper-case letter, this means the upper-case letter
811is required at this position.  The same word with a lower-case letter at this
812position will not match. When some of the other letters are upper-case it will
813not match either.
814
815The word with all upper-case characters will always be OK,
816
817	word list	matches			does not match ~
818	als		als Als ALS		ALs AlS aLs aLS
819	Als		Als  ALS		als ALs AlS aLs aLS
820	ALS		ALS			als Als ALs AlS aLs aLS
821	AlS		AlS ALS			als Als ALs aLs aLS
822
823The KEEPCASE affix ID can be used to specifically match a word with identical
824case only, see below |spell-KEEPCASE|.
825
826Note: in line 5 to 7 non-word characters are used.  You can include any
827character in a word.  When checking the text a word still only matches when it
828appears with a non-word character before and after it.  For Myspell a word
829starting with a non-word character probably won't work.
830
831In line 12 the word "TCP/IP" is defined.  Since the slash has a special
832meaning the comma is used instead.  This is defined with the SLASH item in the
833affix file, see |spell-SLASH|.  Note that without this SLASH item the word
834will be "TCP,IP".
835
836
837AFFIX FILE FORMAT			*spell-aff-format* *spell-affix-vim*
838
839							*spell-affix-comment*
840Comment lines in the .aff file start with a '#':
841
842	# comment line ~
843
844Items with a fixed number of arguments can be followed by a comment.  But only
845if none of the arguments can contain white space.  The comment must start with
846a "#" character.  Example:
847
848	KEEPCASE =  # fix case for words with this flag ~
849
850
851ENCODING							*spell-SET*
852
853The affix file can be in any encoding that is supported by "iconv".  However,
854in some cases the current locale should also be set properly at the time
855|:mkspell| is invoked.  Adding FOL/LOW/UPP lines removes this requirement
856|spell-FOL|.
857
858The encoding should be specified before anything where the encoding matters.
859The encoding applies both to the affix file and the dictionary file.  It is
860done with a SET line:
861
862	SET utf-8 ~
863
864The encoding can be different from the value of the 'encoding' option at the
865time ":mkspell" is used.  Vim will then convert everything to 'encoding' and
866generate a spell file for 'encoding'.  If some of the used characters to not
867fit in 'encoding' you will get an error message.
868							*spell-affix-mbyte*
869When using a multi-byte encoding it's possible to use more different affix
870flags.  But Myspell doesn't support that, thus you may not want to use it
871anyway.  For compatibility use an 8-bit encoding.
872
873
874INFORMATION
875
876These entries in the affix file can be used to add information to the spell
877file.  There are no restrictions on the format, but they should be in the
878right encoding.
879
880				*spell-NAME* *spell-VERSION* *spell-HOME*
881				*spell-AUTHOR* *spell-EMAIL* *spell-COPYRIGHT*
882	NAME		Name of the language
883	VERSION		1.0.1  with fixes
884	HOME		http://www.myhome.eu
885	AUTHOR		John Doe
886	EMAIL		john AT Doe DOT net
887	COPYRIGHT	LGPL
888
889These fields are put in the .spl file as-is.  The |:spellinfo| command can be
890used to view the info.
891
892							*:spellinfo* *:spelli*
893:spelli[nfo]		Display the information for the spell file(s) used for
894			the current buffer.
895
896
897CHARACTER TABLES
898							*spell-affix-chars*
899When using an 8-bit encoding the affix file should define what characters are
900word characters.  This is because the system where ":mkspell" is used may not
901support a locale with this encoding and isalpha() won't work.  For example
902when using "cp1250" on Unix.
903						*E761* *E762* *spell-FOL*
904						*spell-LOW* *spell-UPP*
905Three lines in the affix file are needed.  Simplistic example:
906
907	FOL  áëñ ~
908	LOW  áëñ ~
909	UPP  ÁËÑ ~
910
911All three lines must have exactly the same number of characters.
912
913The "FOL" line specifies the case-folded characters.  These are used to
914compare words while ignoring case.  For most encodings this is identical to
915the lower case line.
916
917The "LOW" line specifies the characters in lower-case.  Mostly it's equal to
918the "FOL" line.
919
920The "UPP" line specifies the characters with upper-case.  That is, a character
921is upper-case where it's different from the character at the same position in
922"FOL".
923
924An exception is made for the German sharp s ß.  The upper-case version is
925"SS".  In the FOL/LOW/UPP lines it should be included, so that it's recognized
926as a word character, but use the ß character in all three.
927
928ASCII characters should be omitted, Vim always handles these in the same way.
929When the encoding is UTF-8 no word characters need to be specified.
930
931							*E763*
932Vim allows you to use spell checking for several languages in the same file.
933You can list them in the 'spelllang' option.  As a consequence all spell files
934for the same encoding must use the same word characters, otherwise they can't
935be combined without errors.
936
937If you get an E763 warning that the word tables differ you need to update your
938".spl" spell files.  If you downloaded the files, get the latest version of
939all spell files you use.  If you are only using one, e.g., German, then also
940download the recent English spell files.  Otherwise generate the .spl file
941again with |:mkspell|.  If you still get errors check the FOL, LOW and UPP
942lines in the used .aff files.
943
944The XX.ascii.spl spell file generated with the "-ascii" argument will not
945contain the table with characters, so that it can be combine with spell files
946for any encoding.  The .add.spl files also do not contain the table.
947
948
949MID-WORD CHARACTERS
950							*spell-midword*
951Some characters are only to be considered word characters if they are used in
952between two ordinary word characters.  An example is the single quote: It is
953often used to put text in quotes, thus it can't be recognized as a word
954character, but when it appears in between word characters it must be part of
955the word.  This is needed to detect a spelling error such as they'are.  That
956should be they're, but since "they" and "are" are words themselves that would
957go unnoticed.
958
959These characters are defined with MIDWORD in the .aff file.  Example:
960
961	MIDWORD	'- ~
962
963
964FLAG TYPES						*spell-FLAG*
965
966Flags are used to specify the affixes that can be used with a word and for
967other properties of the word.  Normally single-character flags are used.  This
968limits the number of possible flags, especially for 8-bit encodings.  The FLAG
969item can be used if more affixes are to be used.  Possible values:
970
971	FLAG long	use two-character flags
972	FLAG num	use numbers, from 1 up to 65000
973	FLAG caplong	use one-character flags without A-Z and two-character
974			flags that start with A-Z
975
976With "FLAG num" the numbers in a list of affixes need to be separated with a
977comma: "234,2143,1435".  This method is inefficient, but useful if the file is
978generated with a program.
979
980When using "caplong" the two-character flags all start with a capital: "Aa",
981"B1", "BB", etc.  This is useful to use one-character flags for the most
982common items and two-character flags for uncommon items.
983
984Note: When using utf-8 only characters up to 65000 may be used for flags.
985
986Note: even when using "num" or "long" the number of flags available to
987compounding and prefixes is limited to about 250.
988
989
990AFFIXES
991					    *spell-PFX* *spell-SFX*
992The usual PFX (prefix) and SFX (suffix) lines are supported (see the Myspell
993documentation or the Aspell manual:
994http://aspell.net/man-html/Affix-Compression.html).
995
996Summary:
997	SFX L Y 2 ~
998	SFX L 0 re [^x] ~
999	SFX L 0 ro x ~
1000
1001The first line is a header and has four fields:
1002	SFX {flag} {combine} {count}
1003
1004{flag}		The name used for the suffix.  Mostly it's a single letter,
1005		but other characters can be used, see |spell-FLAG|.
1006
1007{combine}	Can be 'Y' or 'N'.  When 'Y' then the word plus suffix can
1008		also have a prefix.  When 'N' then a prefix is not allowed.
1009
1010{count}		The number of lines following.  If this is wrong you will get
1011		an error message.
1012
1013For PFX the fields are exactly the same.
1014
1015The basic format for the following lines is:
1016	SFX {flag} {strip} {add} {condition} {extra}
1017
1018{flag}		Must be the same as the {flag} used in the first line.
1019
1020{strip}		Characters removed from the basic word.  There is no check if
1021		the characters are actually there, only the length is used (in
1022		bytes).  This better match the {condition}, otherwise strange
1023		things may happen.  If the {strip} length is equal to or
1024		longer than the basic word the suffix won't be used.
1025		When {strip} is 0 (zero) then nothing is stripped.
1026
1027{add}		Characters added to the basic word, after removing {strip}.
1028		Optionally there is a '/' followed by flags.  The flags apply
1029		to the word plus affix.  See |spell-affix-flags|
1030
1031{condition}	A simplistic pattern.  Only when this matches with a basic
1032		word will the suffix be used for that word.  This is normally
1033		for using one suffix letter with different {add} and {strip}
1034		fields for words with different endings.
1035		When {condition} is a . (dot) there is no condition.
1036		The pattern may contain:
1037		- Literal characters.
1038		- A set of characters in []. [abc] matches a, b and c.
1039		  A dash is allowed for a range [a-c], but this is
1040		  Vim-specific.
1041		- A set of characters that starts with a ^, meaning the
1042		  complement of the specified characters. [^abc] matches any
1043		  character but a, b and c.
1044
1045{extra}		Optional extra text:
1046		    # comment		Comment is ignored
1047		    -			Hunspell uses this, ignored
1048
1049For PFX the fields are the same, but the {strip}, {add} and {condition} apply
1050to the start of the word.
1051
1052Note: Myspell ignores any extra text after the relevant info.  Vim requires
1053this text to start with a "#" so that mistakes don't go unnoticed.  Example:
1054
1055	SFX F 0 in   [^i]n      # Spion > Spionin  ~
1056	SFX F 0 nen  in		# Bauerin > Bauerinnen ~
1057
1058However, to avoid lots of errors in affix files written for Myspell, you can
1059add the IGNOREEXTRA flag.
1060
1061Apparently Myspell allows an affix name to appear more than once.  Since this
1062might also be a mistake, Vim checks for an extra "S".  The affix files for
1063Myspell that use this feature apparently have this flag.  Example:
1064
1065	SFX a Y 1 S ~
1066	SFX a 0 an . ~
1067
1068	SFX a Y 2 S ~
1069	SFX a 0 en . ~
1070	SFX a 0 on . ~
1071
1072
1073AFFIX FLAGS						*spell-affix-flags*
1074
1075This is a feature that comes from Hunspell: The affix may specify flags.  This
1076works similar to flags specified on a basic word.  The flags apply to the
1077basic word plus the affix (but there are restrictions).  Example:
1078
1079	SFX S Y 1 ~
1080	SFX S 0 s . ~
1081
1082	SFX A Y 1 ~
1083	SFX A 0 able/S . ~
1084
1085When the dictionary file contains "drink/AS" then these words are possible:
1086
1087	drink
1088	drinks		uses S suffix
1089	drinkable	uses A suffix
1090	drinkables	uses A suffix and then S suffix
1091
1092Generally the flags of the suffix are added to the flags of the basic word,
1093both are used for the word plus suffix.  But the flags of the basic word are
1094only used once for affixes, except that both one prefix and one suffix can be
1095used when both support combining.
1096
1097Specifically, the affix flags can be used for:
1098- Suffixes on suffixes, as in the example above.  This works once, thus you
1099  can have two suffixes on a word (plus one prefix).
1100- Making the word with the affix rare, by using the |spell-RARE| flag.
1101- Exclude the word with the affix from compounding, by using the
1102  |spell-COMPOUNDFORBIDFLAG| flag.
1103- Allow the word with the affix to be part of a compound word on the side of
1104  the affix with the |spell-COMPOUNDPERMITFLAG|.
1105- Use the NEEDCOMPOUND flag: word plus affix can only be used as part of a
1106  compound word. |spell-NEEDCOMPOUND|
1107- Compound flags: word plus affix can be part of a compound word at the end,
1108  middle, start, etc.  The flags are combined with the flags of the basic
1109  word.  |spell-compound|
1110- NEEDAFFIX: another affix is needed to make a valid word.
1111- CIRCUMFIX, as explained just below.
1112
1113
1114IGNOREEXTRA						*spell-IGNOREEXTRA*
1115
1116Normally Vim gives an error for an extra field that does not start with '#'.
1117This avoids errors going unnoticed.  However, some files created for Myspell
1118or Hunspell may contain many entries with an extra field.  Use the IGNOREEXTRA
1119flag to avoid lots of errors.
1120
1121
1122CIRCUMFIX						*spell-CIRCUMFIX*
1123
1124The CIRCUMFIX flag means a prefix and suffix must be added at the same time.
1125If a prefix has the CIRCUMFIX flag than only suffixes with the CIRCUMFIX flag
1126can be added, and the other way around.
1127An alternative is to only specify the suffix, and give the that suffix two
1128flags: The required prefix and the NEEDAFFIX flag.  |spell-NEEDAFFIX|
1129
1130
1131PFXPOSTPONE						*spell-PFXPOSTPONE*
1132
1133When an affix file has very many prefixes that apply to many words it's not
1134possible to build the whole word list in memory.  This applies to Hebrew (a
1135list with all words is over a Gbyte).  In that case applying prefixes must be
1136postponed.  This makes spell checking slower.  It is indicated by this keyword
1137in the .aff file:
1138
1139	PFXPOSTPONE ~
1140
1141Only prefixes without a chop string and without flags can be postponed.
1142Prefixes with a chop string or with flags will still be included in the word
1143list.  An exception if the chop string is one character and equal to the last
1144character of the added string, but in lower case.  Thus when the chop string
1145is used to allow the following word to start with an upper case letter.
1146
1147
1148WORDS WITH A SLASH					*spell-SLASH*
1149
1150The slash is used in the .dic file to separate the basic word from the affix
1151letters and other flags.  Unfortunately, this means you cannot use a slash in
1152a word.  Thus "TCP/IP" is not a word but "TCP" with the flags "IP".  To include
1153a slash in the word put a backslash before it: "TCP\/IP".  In the rare case
1154you want to use a backslash inside a word you need to use two backslashes.
1155Any other use of the backslash is reserved for future expansion.
1156
1157
1158KEEP-CASE WORDS						*spell-KEEPCASE*
1159
1160In the affix file a KEEPCASE line can be used to define the affix name used
1161for keep-case words.  Example:
1162
1163	KEEPCASE = ~
1164
1165This flag is not supported by Myspell.  It has the meaning that case matters.
1166This can be used if the word does not have the first letter in upper case at
1167the start of a sentence.  Example:
1168
1169    word list	    matches		    does not match ~
1170    's morgens/=    's morgens		    'S morgens 's Morgens 'S MORGENS
1171    's Morgens	    's Morgens 'S MORGENS   'S morgens 's morgens
1172
1173The flag can also be used to avoid that the word matches when it is in all
1174upper-case letters.
1175
1176
1177RARE WORDS						*spell-RARE*
1178
1179In the affix file a RARE line can be used to define the affix name used for
1180rare words.  Example:
1181
1182	RARE ? ~
1183
1184Rare words are highlighted differently from bad words.  This is to be used for
1185words that are correct for the language, but are hardly ever used and could be
1186a typing mistake anyway.  When the same word is found as good it won't be
1187highlighted as rare.
1188
1189This flag can also be used on an affix, so that a basic word is not rare but
1190the basic word plus affix is rare |spell-affix-flags|.  However, if the word
1191also appears as a good word in another way (e.g., in another region) it won't
1192be marked as rare.
1193
1194
1195BAD WORDS						*spell-BAD*
1196
1197In the affix file a BAD line can be used to define the affix name used for
1198bad words.  Example:
1199
1200	BAD ! ~
1201
1202This can be used to exclude words that would otherwise be good.  For example
1203"the the" in the .dic file:
1204
1205	the the/! ~
1206
1207Once a word has been marked as bad it won't be undone by encountering the same
1208word as good.
1209
1210The flag also applies to the word with affixes, thus this can be used to mark
1211a whole bunch of related words as bad.
1212
1213							*spell-FORBIDDENWORD*
1214FORBIDDENWORD can be used just like BAD.  For compatibility with Hunspell.
1215
1216							*spell-NEEDAFFIX*
1217The NEEDAFFIX flag is used to require that a word is used with an affix.  The
1218word itself is not a good word (unless there is an empty affix).  Example:
1219
1220	NEEDAFFIX + ~
1221
1222
1223COMPOUND WORDS						*spell-compound*
1224
1225A compound word is a longer word made by concatenating words that appear in
1226the .dic file.  To specify which words may be concatenated a character is
1227used.  This character is put in the list of affixes after the word.  We will
1228call this character a flag here.  Obviously these flags must be different from
1229any affix IDs used.
1230
1231							*spell-COMPOUNDFLAG*
1232The Myspell compatible method uses one flag, specified with COMPOUNDFLAG.  All
1233words with this flag combine in any order.  This means there is no control
1234over which word comes first.  Example:
1235	COMPOUNDFLAG c ~
1236
1237							*spell-COMPOUNDRULE*
1238A more advanced method to specify how compound words can be formed uses
1239multiple items with multiple flags.  This is not compatible with Myspell 3.0.
1240Let's start with an example:
1241	COMPOUNDRULE c+ ~
1242	COMPOUNDRULE se ~
1243
1244The first line defines that words with the "c" flag can be concatenated in any
1245order.  The second line defines compound words that are made of one word with
1246the "s" flag and one word with the "e" flag.  With this dictionary:
1247	bork/c ~
1248	onion/s ~
1249	soup/e ~
1250
1251You can make these words:
1252	bork
1253	borkbork
1254	borkborkbork
1255	(etc.)
1256	onion
1257	soup
1258	onionsoup
1259
1260The COMPOUNDRULE item may appear multiple times.  The argument is made out of
1261one or more groups, where each group can be:
1262	one flag			e.g., c
1263	alternate flags inside []	e.g., [abc]
1264Optionally this may be followed by:
1265	*	the group appears zero or more times, e.g., sm*e
1266	+	the group appears one or more times, e.g., c+
1267	?	the group appears zero times or once, e.g., x?
1268
1269This is similar to the regexp pattern syntax (but not the same!).  A few
1270examples with the sequence of word flags they require:
1271    COMPOUNDRULE x+	    x xx xxx etc.
1272    COMPOUNDRULE yz	    yz
1273    COMPOUNDRULE x+z	    xz xxz xxxz etc.
1274    COMPOUNDRULE yx+	    yx yxx yxxx etc.
1275    COMPOUNDRULE xy?z	    xz xyz
1276
1277    COMPOUNDRULE [abc]z    az bz cz
1278    COMPOUNDRULE [abc]+z   az aaz abaz bz baz bcbz cz caz cbaz etc.
1279    COMPOUNDRULE a[xyz]+   ax axx axyz ay ayx ayzz az azy azxy etc.
1280    COMPOUNDRULE sm*e	    se sme smme smmme etc.
1281    COMPOUNDRULE s[xyz]*e  se sxe sxye sxyxe sye syze sze szye szyxe  etc.
1282
1283A specific example: Allow a compound to be made of two words and a dash:
1284	In the .aff file:
1285	    COMPOUNDRULE sde ~
1286	    NEEDAFFIX x ~
1287	    COMPOUNDWORDMAX 3 ~
1288	    COMPOUNDMIN 1 ~
1289	In the .dic file:
1290	    start/s ~
1291	    end/e ~
1292	    -/xd ~
1293
1294This allows for the word "start-end", but not "startend".
1295
1296An additional implied rule is that, without further flags, a word with a
1297prefix cannot be compounded after another word, and a word with a suffix
1298cannot be compounded with a following word.  Thus the affix cannot appear
1299on the inside of a compound word.  This can be changed with the
1300|spell-COMPOUNDPERMITFLAG|.
1301
1302							*spell-NEEDCOMPOUND*
1303The NEEDCOMPOUND flag is used to require that a word is used as part of a
1304compound word.  The word itself is not a good word.  Example:
1305
1306	NEEDCOMPOUND & ~
1307
1308							*spell-ONLYINCOMPOUND*
1309The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND.  Supported for
1310compatibility with Hunspell.
1311
1312							*spell-COMPOUNDMIN*
1313The minimal character length of a word used for compounding is specified with
1314COMPOUNDMIN.  Example:
1315	COMPOUNDMIN 5 ~
1316
1317When omitted there is no minimal length.  Obviously you could just leave out
1318the compound flag from short words instead, this feature is present for
1319compatibility with Myspell.
1320
1321							*spell-COMPOUNDWORDMAX*
1322The maximum number of words that can be concatenated into a compound word is
1323specified with COMPOUNDWORDMAX.  Example:
1324	COMPOUNDWORDMAX 3 ~
1325
1326When omitted there is no maximum.  It applies to all compound words.
1327
1328To set a limit for words with specific flags make sure the items in
1329COMPOUNDRULE where they appear don't allow too many words.
1330
1331							*spell-COMPOUNDSYLMAX*
1332The maximum number of syllables that a compound word may contain is specified
1333with COMPOUNDSYLMAX.  Example:
1334	COMPOUNDSYLMAX 6 ~
1335
1336This has no effect if there is no SYLLABLE item.  Without COMPOUNDSYLMAX there
1337is no limit on the number of syllables.
1338
1339If both COMPOUNDWORDMAX and COMPOUNDSYLMAX are defined, a compound word is
1340accepted if it fits one of the criteria, thus is either made from up to
1341COMPOUNDWORDMAX words or contains up to COMPOUNDSYLMAX syllables.
1342
1343						    *spell-COMPOUNDFORBIDFLAG*
1344The COMPOUNDFORBIDFLAG specifies a flag that can be used on an affix.  It
1345means that the word plus affix cannot be used in a compound word.  Example:
1346	affix file:
1347		COMPOUNDFLAG c ~
1348		COMPOUNDFORBIDFLAG x ~
1349		SFX a Y 2 ~
1350		SFX a 0 s   . ~
1351		SFX a 0 ize/x . ~
1352	dictionary:
1353		word/c ~
1354		util/ac ~
1355
1356This allows for "wordutil" and "wordutils" but not "wordutilize".
1357Note: this doesn't work for postponed prefixes yet.
1358
1359						    *spell-COMPOUNDPERMITFLAG*
1360The COMPOUNDPERMITFLAG specifies a flag that can be used on an affix.  It
1361means that the word plus affix can also be used in a compound word in a way
1362where the affix ends up halfway the word.  Without this flag that is not
1363allowed.
1364Note: this doesn't work for postponed prefixes yet.
1365
1366						    *spell-COMPOUNDROOT*
1367The COMPOUNDROOT flag is used for words in the dictionary that are already a
1368compound.  This means it counts for two words when checking the compounding
1369rules.  Can also be used for an affix to count the affix as a compounding
1370word.
1371
1372						*spell-CHECKCOMPOUNDPATTERN*
1373CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
1374position where two words are compounded together forbids the compound.
1375For example:
1376	CHECKCOMPOUNDPATTERN o e ~
1377
1378This forbids compounding if the first word ends in "o" and the second word
1379starts with "e".
1380
1381The arguments must be plain text, no patterns are actually supported, despite
1382the item name.  Case is always ignored.
1383
1384The Hunspell feature to use three arguments and flags is not supported.
1385
1386							*spell-NOCOMPOUNDSUGS*
1387This item indicates that using compounding to make suggestions is not a good
1388idea.  Use this when compounding is used with very short or one-character
1389words.  E.g. to make numbers out of digits.  Without this flag creating
1390suggestions would spend most time trying all kind of weird compound words.
1391
1392	NOCOMPOUNDSUGS ~
1393
1394							*spell-SYLLABLE*
1395The SYLLABLE item defines characters or character sequences that are used to
1396count the number of syllables in a word.  Example:
1397	SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~
1398
1399Before the first slash is the set of characters that are counted for one
1400syllable, also when repeated and mixed, until the next character that is not
1401in this set.  After the slash come sequences of characters that are counted
1402for one syllable.  These are preferred over using characters from the set.
1403With the example "ideeen" has three syllables, counted by "i", "ee" and "e".
1404
1405Only case-folded letters need to be included.
1406
1407Another way to restrict compounding was mentioned above: Adding the
1408|spell-COMPOUNDFORBIDFLAG| flag to an affix causes all words that are made
1409with that affix to not be used for compounding.
1410
1411
1412UNLIMITED COMPOUNDING					*spell-NOBREAK*
1413
1414For some languages, such as Thai, there is no space in between words.  This
1415looks like all words are compounded.  To specify this use the NOBREAK item in
1416the affix file, without arguments:
1417	NOBREAK ~
1418
1419Vim will try to figure out where one word ends and a next starts.  When there
1420are spelling mistakes this may not be quite right.
1421
1422
1423							*spell-COMMON*
1424Common words can be specified with the COMMON item.  This will give better
1425suggestions when editing a short file.  Example:
1426
1427	COMMON  the of to and a in is it you that he was for on are ~
1428
1429The words must be separated by white space, up to 25 per line.
1430When multiple regions are specified in a ":mkspell" command the common words
1431for all regions are combined and used for all regions.
1432
1433							*spell-NOSPLITSUGS*
1434This item indicates that splitting a word to make suggestions is not a good
1435idea.  Split-word suggestions will appear only when there are few similar
1436words.
1437
1438	NOSPLITSUGS ~
1439
1440							*spell-NOSUGGEST*
1441The flag specified with NOSUGGEST can be used for words that will not be
1442suggested.  Can be used for obscene words.
1443
1444	NOSUGGEST % ~
1445
1446
1447REPLACEMENTS						*spell-REP*
1448
1449In the affix file REP items can be used to define common mistakes.  This is
1450used to make spelling suggestions.  The items define the "from" text and the
1451"to" replacement.  Example:
1452
1453	REP 4 ~
1454	REP f ph ~
1455	REP ph f ~
1456	REP k ch ~
1457	REP ch k ~
1458
1459The first line specifies the number of REP lines following.  Vim ignores the
1460number, but it must be there (for compatibility with Myspell).
1461
1462Don't include simple one-character replacements or swaps.  Vim will try these
1463anyway.  You can include whole words if you want to, but you might want to use
1464the "file:" item in 'spellsuggest' instead.
1465
1466You can include a space by using an underscore:
1467
1468	REP the_the the ~
1469
1470
1471SIMILAR CHARACTERS					*spell-MAP* *E783*
1472
1473In the affix file MAP items can be used to define letters that are very much
1474alike.  This is mostly used for a letter with different accents.  This is used
1475to prefer suggestions with these letters substituted.  Example:
1476
1477	MAP 2 ~
1478	MAP eéëêè ~
1479	MAP uüùúû ~
1480
1481The first line specifies the number of MAP lines following.  Vim ignores the
1482number, but the line must be there.
1483
1484Each letter must appear in only one of the MAP items.  It's a bit more
1485efficient if the first letter is ASCII or at least one without accents.
1486
1487
1488.SUG FILE						*spell-NOSUGFILE*
1489
1490When soundfolding is specified in the affix file then ":mkspell" will normally
1491produce a .sug file next to the .spl file.  This file is used to find
1492suggestions by their sound-a-like form quickly.  At the cost of a lot of
1493memory (the amount depends on the number of words, |:mkspell| will display an
1494estimate when it's done).
1495
1496To avoid producing a .sug file use this item in the affix file:
1497
1498	NOSUGFILE ~
1499
1500Users can simply omit the .sug file if they don't want to use it.
1501
1502
1503SOUND-A-LIKE						*spell-SAL*
1504
1505In the affix file SAL items can be used to define the sounds-a-like mechanism
1506to be used.  The main items define the "from" text and the "to" replacement.
1507Simplistic example:
1508
1509	SAL CIA			 X ~
1510	SAL CH			 X ~
1511	SAL C			 K ~
1512	SAL K			 K ~
1513
1514There are a few rules and this can become quite complicated.  An explanation
1515how it works can be found in the Aspell manual:
1516http://aspell.net/man-html/Phonetic-Code.html.
1517
1518There are a few special items:
1519
1520	SAL followup		true ~
1521	SAL collapse_result	true ~
1522	SAL remove_accents	true ~
1523
1524"1" has the same meaning as "true".  Any other value means "false".
1525
1526
1527SIMPLE SOUNDFOLDING				*spell-SOFOFROM* *spell-SOFOTO*
1528
1529The SAL mechanism is complex and slow.  A simpler mechanism is mapping all
1530characters to another character, mapping similar sounding characters to the
1531same character.  At the same time this does case folding.  You can not have
1532both SAL items and simple soundfolding.
1533
1534There are two items required: one to specify the characters that are mapped
1535and one that specifies the characters they are mapped to.  They must have
1536exactly the same number of characters.  Example:
1537
1538    SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ~
1539    SOFOTO   ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkes ~
1540
1541In the example all vowels are mapped to the same character 'e'.  Another
1542method would be to leave out all vowels.  Some characters that sound nearly
1543the same and are often mixed up, such as 'm' and 'n', are mapped to the same
1544character.  Don't do this too much, all words will start looking alike.
1545
1546Characters that do not appear in SOFOFROM will be left out, except that all
1547white space is replaced by one space.  Sequences of the same character in
1548SOFOFROM are replaced by one.
1549
1550You can use the |soundfold()| function to try out the results.  Or set the
1551'verbose' option to see the score in the output of the |z=| command.
1552
1553
1554UNSUPPORTED ITEMS				*spell-affix-not-supported*
1555
1556These items appear in the affix file of other spell checkers.  In Vim they are
1557ignored, not supported or defined in another way.
1558
1559ACCENT		(Hunspell)				*spell-ACCENT*
1560		Use MAP instead. |spell-MAP|
1561
1562BREAK		(Hunspell)				*spell-BREAK*
1563		Define break points.  Unclear how it works exactly.
1564		Not supported.
1565
1566CHECKCOMPOUNDCASE  (Hunspell)			*spell-CHECKCOMPOUNDCASE*
1567		Disallow uppercase letters at compound word boundaries.
1568		Not supported.
1569
1570CHECKCOMPOUNDDUP  (Hunspell)			*spell-CHECKCOMPOUNDDUP*
1571		Disallow using the same word twice in a compound.  Not
1572		supported.
1573
1574CHECKCOMPOUNDREP  (Hunspell)			*spell-CHECKCOMPOUNDREP*
1575		Something about using REP items and compound words.  Not
1576		supported.
1577
1578CHECKCOMPOUNDTRIPLE  (Hunspell)			*spell-CHECKCOMPOUNDTRIPLE*
1579		Forbid three identical characters when compounding.  Not
1580		supported.
1581
1582CHECKSHARPS  (Hunspell))			*spell-CHECKSHARPS*
1583		SS letter pair in uppercased (German) words may be upper case
1584		sharp s (ß). Not supported.
1585
1586COMPLEXPREFIXES  (Hunspell)				*spell-COMPLEXPREFIXES*
1587		Enables using two prefixes.  Not supported.
1588
1589COMPOUND	(Hunspell)				*spell-COMPOUND*
1590		This is one line with the count of COMPOUND items, followed by
1591		that many COMPOUND lines with a pattern.
1592		Remove the first line with the count and rename the other
1593		items to COMPOUNDRULE |spell-COMPOUNDRULE|
1594
1595COMPOUNDFIRST	(Hunspell)				*spell-COMPOUNDFIRST*
1596		Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1597
1598COMPOUNDBEGIN	(Hunspell)				*spell-COMPOUNDBEGIN*
1599		Words signed with COMPOUNDBEGIN may be first elements in
1600		compound words.
1601		Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1602
1603COMPOUNDLAST	(Hunspell)				*spell-COMPOUNDLAST*
1604		Words signed with COMPOUNDLAST may be last elements in
1605		compound words.
1606		Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1607
1608COMPOUNDEND	(Hunspell)				*spell-COMPOUNDEND*
1609		Probably the same as COMPOUNDLAST
1610
1611COMPOUNDMIDDLE	(Hunspell)				*spell-COMPOUNDMIDDLE*
1612		Words signed with COMPOUNDMIDDLE may be middle elements in
1613		compound words.
1614		Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1615
1616COMPOUNDRULES	(Hunspell)				*spell-COMPOUNDRULES*
1617		Number of COMPOUNDRULE lines following.  Ignored, but the
1618		argument must be a number.
1619
1620COMPOUNDSYLLABLE  (Hunspell)			*spell-COMPOUNDSYLLABLE*
1621		Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
1622		|spell-COMPOUNDSYLMAX|
1623
1624KEY		(Hunspell)				*spell-KEY*
1625		Define characters that are close together on the keyboard.
1626		Used to give better suggestions.  Not supported.
1627
1628LANG		(Hunspell)				*spell-LANG*
1629		This specifies language-specific behavior.  This actually
1630		moves part of the language knowledge into the program,
1631		therefore Vim does not support it.  Each language property
1632		must be specified separately.
1633
1634LEMMA_PRESENT	(Hunspell)				*spell-LEMMA_PRESENT*
1635		Only needed for morphological analysis.
1636
1637MAXNGRAMSUGS	(Hunspell)				*spell-MAXNGRAMSUGS*
1638		Set number of n-gram suggestions.  Not supported.
1639
1640PSEUDOROOT	(Hunspell)				*spell-PSEUDOROOT*
1641		Use NEEDAFFIX instead. |spell-NEEDAFFIX|
1642
1643SUGSWITHDOTS	(Hunspell)				*spell-SUGSWITHDOTS*
1644		Adds dots to suggestions.  Vim doesn't need this.
1645
1646SYLLABLENUM	(Hunspell)				*spell-SYLLABLENUM*
1647		Not supported.
1648
1649TRY		(Myspell, Hunspell, others)		*spell-TRY*
1650		Vim does not use the TRY item, it is ignored.  For making
1651		suggestions the actual characters in the words are used, that
1652		is much more efficient.
1653
1654WORDCHARS	(Hunspell)				*spell-WORDCHARS*
1655		Used to recognize words.  Vim doesn't need it, because there
1656		is no need to separate words before checking them (using a
1657		trie instead of a hashtable).
1658
1659 vim:tw=78:sw=4:ts=8:noet:ft=help:norl:
1660