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