Add support for :winpos
[MacVim.git] / runtime / doc / spell.txt
blob8a559dde86eedfc70c0f6e9df7640047d013c439
1 *spell.txt*     For Vim version 7.2.  Last change: 2009 Oct 28
4                   VIM REFERENCE MANUAL    by Bram Moolenaar
7 Spell checking                                          *spell*
9 1. Quick start                  |spell-quickstart|
10 2. Remarks on spell checking    |spell-remarks|
11 3. Generating a spell file      |spell-mkspell|
12 4. Spell file format            |spell-file-format|
14 {Vi does not have any of these commands}
16 Spell checking is not available when the |+syntax| feature has been disabled
17 at compile time.
19 Note: There also is a vimspell plugin.  If you have it you can do ":help
20 vimspell" to find about it.  But you will probably want to get rid of the
21 plugin and use the 'spell' option instead, it works better.
23 ==============================================================================
24 1. Quick start                                  *spell-quickstart* *E756*
26 This command switches on spell checking: >
28         :setlocal spell spelllang=en_us
30 This switches on the 'spell' option and specifies to check for US English.
32 The 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|
38 Vim only checks words for spelling, there is no grammar check.
40 If the 'mousemodel' option is set to "popup" and the cursor is on a badly
41 spelled word or it is "popup_setpos" and the mouse pointer is on a badly
42 spelled word, then the popup menu will contain a submenu to replace the bad
43 word.  Note: this slows down the appearance of the popup menu.  Note for GTK:
44 don't release the right mouse button until the menu appears, otherwise it
45 won't work.
47 To search for the next misspelled word:
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.
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.
61                                                         *]S*
62 ]S                      Like "]s" but only stop at bad words, not at rare
63                         words or words for another region.
65                                                         *[S*
66 [S                      Like "]S" but search backwards.
69 To add words to your own word list:
71                                                         *zg*
72 zg                      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.
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.
84                         If the word is explicitly marked as bad word in
85                         another spell file the result is unpredictable.
87                                                         *zG*
88 zG                      Like "zg" but add the word to the internal word list
89                         |internal-wordlist|.
91                                                         *zw*
92 zw                      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.
97                                                         *zW*
98 zW                      Like "zw" but add the word to the internal word list
99                         |internal-wordlist|.
101 zuw                                                     *zug* *zuw*
102 zug                     Undo |zw| and |zg|, remove the word from the entry in
103                         'spellfile'.  Count used as with |zg|.
105 zuW                                                     *zuG* *zuW*
106 zuG                     Undo |zW| and |zG|, remove the word from the internal
107                         word list.  Count used as with |zg|.
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.
115 :spe[llgood]! {word}    Add {word} as a good word to the internal word list,
116                         like with |zG|.
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.
124 :spellw[rong]! {word}   Add {word} as a wrong (bad) word to the internal word
125                         list, like with |zW|.
127 :[count]spellu[ndo] {word}                              *:spellu* *:spellundo*
128                         Like |zuw|.  [count] used as with |:spellgood|.
130 :spellu[ndo]! {word}    Like |zuW|.  [count] used as with |:spellgood|.
133 After 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
136 commands mostly works well: >
137         :edit <file in 'spellfile'>
138 <       (make changes to the spell file) >
139         :mkspell! %
141 More details about the 'spellfile' format below |spell-wordlist-format|.
143                                                         *internal-wordlist*
144 The internal word list is used for all buffers where 'spell' is set.  It is
145 not stored, it is lost when you exit Vim.  It is also cleared when 'encoding'
146 is set.
149 Finding suggestions for bad words:
150                                                         *z=*
151 z=                      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.
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.
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 "<".
174                         If a count is used that suggestion is used, without
175                         prompting.  For example, "1z=" always takes the first
176                         suggestion.
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.
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.
191 In Insert mode, when the cursor is after a badly spelled word, you can use
192 CTRL-X s to find suggestions.  This works like Insert mode completion.  Use
193 CTRL-N to use the next suggestion, CTRL-P to go back. |i_CTRL-X_s|
195 The 'spellsuggest' option influences how the list of suggestions is generated
196 and sorted.  See |'spellsuggest'|.
198 The 'spellcapcheck' option is used to check the first word of a sentence
199 starts with a capital.  This doesn't work for the first word in the file.
200 When there is a line break right after a sentence the highlighting of the next
201 line may be postponed.  Use |CTRL-L| when needed.  Also see |set-spc-auto| for
202 how it can be set automatically when 'spelllang' is set.
204 Vim counts the number of times a good word is encountered.  This is used to
205 sort the suggestions: words that have been seen before get a small bonus,
206 words that have been seen often get a bigger bonus.  The COMMON item in the
207 affix file can be used to define common words, so that this mechanism also
208 works in a new or short file |spell-COMMON|.
210 ==============================================================================
211 2. Remarks on spell checking                            *spell-remarks*
213 PERFORMANCE
215 Vim does on-the-fly spell checking.  To make this work fast the word list is
216 loaded in memory.  Thus this uses a lot of memory (1 Mbyte or more).  There
217 might also be a noticeable delay when the word list is loaded, which happens
218 when 'spell' is set and when 'spelllang' is set while 'spell' was already set.
219 To minimize the delay each word list is only loaded once, it is not deleted
220 when 'spelllang' is made empty or 'spell' is reset.  When 'encoding' is set
221 all the word lists are reloaded, thus you may notice a delay then too.
224 REGIONS
226 A word may be spelled differently in various regions.  For example, English
227 comes in (at least) these variants:
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
236 Words that are not used in one region but are used in another region are
237 highlighted with SpellLocal |hl-SpellLocal|.
239 Always use lowercase letters for the language and region names.
241 When adding a word with |zg| or another command it's always added for all
242 regions.  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
245 region (not counting files specified by their .spl name).
247                                                         *spell-german*
248 Specific 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
256                                                         *spell-russian*
257 Specific 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
262                                                         *spell-yiddish*
263 Yiddish requires using "utf-8" encoding, because of the special characters
264 used.  If you are using latin1 Vim will use transliterated (romanized) Yiddish
265 instead.  If you want to use transliterated Yiddish with utf-8 use "yi-tr".
266 In a table:
267         'encoding'      'spelllang'
268         utf-8           yi              Yiddish
269         latin1          yi              transliterated Yiddish
270         utf-8           yi-tr           transliterated Yiddish
273 SPELL FILES                                             *spell-load*
275 Vim 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'
280 The value for "LL" comes from 'spelllang', but excludes the region name.
281 Examples:
282         'spelllang'     LL ~
283         en_us           en
284         en-rare         en-rare
285         medical_ca      medical
287 Only the first file is loaded, the one that is first in 'runtimepath'.  If
288 this succeeds then additionally files with the name LL.EEE.add.spl are loaded.
289 All the ones that are found are used.
291 If no spell file is found the |SpellFileMissing| autocommand event is
292 triggered.  This may trigger the |spellfile.vim| plugin to offer you
293 downloading the spell file.
295 Additionally, the files related to the names in 'spellfile' are loaded.  These
296 are the files that |zg| and |zw| add good and wrong words to.
298 Exceptions:
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.
307 For example, with these values:
308         'runtimepath' is "~/.vim,/usr/share/vim70,~/.vim/after"
309         'encoding'    is "iso-8859-2"
310         'spelllang'   is "pl"
312 Vim will look for:
313 1. ~/.vim/spell/pl.iso-8859-2.spl
314 2. /usr/share/vim70/spell/pl.iso-8859-2.spl
315 3. ~/.vim/spell/pl.iso-8859-2.add.spl
316 4. /usr/share/vim70/spell/pl.iso-8859-2.add.spl
317 5. ~/.vim/after/spell/pl.iso-8859-2.add.spl
319 This assumes 1. is not found and 2. is found.
321 If 'encoding' is "latin1" Vim will look for:
322 1. ~/.vim/spell/pl.latin1.spl
323 2. /usr/share/vim70/spell/pl.latin1.spl
324 3. ~/.vim/after/spell/pl.latin1.spl
325 4. ~/.vim/spell/pl.ascii.spl
326 5. /usr/share/vim70/spell/pl.ascii.spl
327 6. ~/.vim/after/spell/pl.ascii.spl
329 This assumes none of them are found (Polish doesn't make sense when leaving
330 out the non-ASCII characters).
332 Spelling for EBCDIC is currently not supported.
334 A 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
336 with "iconv" will NOT work!
338                                                     *spell-sug-file* *E781*
339 If 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
341 before suggestions are made to reduce memory use.
343                                     *E758* *E759* *E778* *E779* *E780* *E782*
344 When loading a spell file Vim checks that it is properly formatted.  If you
345 get an error the file may be truncated, modified or intended for another Vim
346 version.
349 SPELLFILE CLEANUP                                       *spellfile-cleanup*
351 The |zw| command turns existing entries in 'spellfile' into comment lines.
352 This avoids having to write a new file every time, but results in the file
353 only getting longer, never shorter.  To clean up the comment lines in all
354 ".add" spell files do this: >
355         :runtime spell/cleanadd.vim
357 This deletes all comment lines, except the ones that start with "##".  Use
358 "##" lines to add comments that you want to keep.
360 You can invoke this script as often as you like.  A variable is provided to
361 skip updating files that have been changed recently.  Set it to the number of
362 seconds that has passed since a file was changed before it will be cleaned.
363 For example, to clean only files that were not changed in the last hour: >
364       let g:spell_clean_limit = 60 * 60
365 The default is one second.
368 WORDS
370 Vim 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
372 include characters like '-' in 'iskeyword'.  The word characters do depend on
373 'encoding'.
375 The table with word characters is stored in the main .spl file.  Therefore it
376 matters what the current locale is when generating it!  A .add.spl file does
377 not contain a word table though.
379 For a word that starts with a digit the digit is ignored, unless the word as a
380 whole is recognized.  Thus if "3D" is a word and "D" is not then "3D" is
381 recognized as a word, but if "3D" is not a word then only the "D" is marked as
382 bad.  Hex numbers in the form 0x12ab and 0X12AB are recognized.
385 WORD COMBINATIONS
387 It is possible to spell-check words that include a space.  This is used to
388 recognize words that are invalid when used by themselves, e.g. for "et al.".
389 It can also be used to recognize "the the" and highlight it.
391 The number of spaces is irrelevant.  In most cases a line break may also
392 appear.  However, this makes it difficult to find out where to start checking
393 for spelling mistakes.  When you make a change to one line and only that line
394 is redrawn Vim won't look in the previous line, thus when "et" is at the end
395 of 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.
397 Use |CTRL-L| to redraw right away.  "[s" will also stop at a word combination
398 with a line break.
400 When encountering a line break Vim skips characters such as '*', '>' and '"',
401 so that comments in C, shell and Vim code can be spell checked.
404 SYNTAX HIGHLIGHTING                                     *spell-syntax*
406 Files that use syntax highlighting can specify where spell checking should be
407 done:
409 1.  everywhere                     default
410 2.  in specific items              use "contains=@Spell"
411 3.  everywhere but specific items  use "contains=@NoSpell"
413 For the second method adding the @NoSpell cluster will disable spell checking
414 again.  This can be used, for example, to add @Spell to the comments of a
415 program, and add @NoSpell for items that shouldn't be checked.
416 Also see |:syn-spell| for text that is not in a syntax item.
419 VIM SCRIPTS
421 If you want to write a Vim script that does something with spelling, you may
422 find these functions useful:
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
429 SETTING 'spellcapcheck' AUTOMATICALLY                   *set-spc-auto*
431 After the 'spelllang' option has been set successfully, Vim will source the
432 files "spell/LANG.vim" in 'runtimepath'.  "LANG" is the value of 'spelllang'
433 up to the first comma, dot or underscore.  This can be used to set options
434 specifically for the language, especially 'spellcapcheck'.
436 The distribution includes a few of these files.  Use this command to see what
437 they do: >
438         :next $VIMRUNTIME/spell/*.vim
440 Note that the default scripts don't set 'spellcapcheck' if it was changed from
441 the default value.  This assumes the user prefers another value then.
444 DOUBLE SCORING                                          *spell-double-scoring*
446 The 'spellsuggest' option can be used to select "double" scoring.  This
447 mechanism is based on the principle that there are two kinds of spelling
448 mistakes:
450 1. 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.
454 2. 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.
457 Since scores for these two mistakes will be very different we use a list
458 for each and mix them.
460 The sound-folding is slow and people that know the language won't make the
461 second kind of mistakes.  Therefore 'spellsuggest' can be set to select the
462 preferred method for scoring the suggestions.
464 ==============================================================================
465 3. Generating a spell file                              *spell-mkspell*
467 Vim uses a binary file format for spelling.  This greatly speeds up loading
468 the word list and keeps it small.
469                                                     *.aff* *.dic* *Myspell*
470 You can create a Vim spell file from the .aff and .dic files that Myspell
471 uses.  Myspell is used by OpenOffice.org and Mozilla.  You should be able to
472 find them here:
473         http://wiki.services.openoffice.org/wiki/Dictionaries
474 You can also use a plain word list.  The results are the same, the choice
475 depends on what word lists you can find.
477 If you install Aap (from www.a-a-p.org) you can use the recipes in the
478 runtime/spell/??/ directories.  Aap will take care of downloading the files,
479 apply patches needed for Vim and build the .spl file.
481 Make sure your current locale is set properly, otherwise Vim doesn't know what
482 characters are upper/lower case letters.  If the locale isn't available (e.g.,
483 when using an MS-Windows codepage on Unix) add tables to the .aff file
484 |spell-affix-chars|.  If the .aff file doesn't define a table then the word
485 table of the currently active spelling is used.  If spelling is not active
486 then Vim will try to guess.
488                                                         *:mksp* *:mkspell*
489 :mksp[ell][!] [-ascii] {outname} {inname} ...
490                         Generate a Vim spell file from word lists.  Example: >
491                 :mkspell /tmp/nl nl_NL.words
492 <                                                               *E751*
493                         When {outname} ends in ".spl" it is used as the output
494                         file name.  Otherwise it should be a language name,
495                         such as "en", without the region name.  The file
496                         written will be "{outname}.{encoding}.spl", where
497                         {encoding} is the value of the 'encoding' option.
499                         When the output file already exists [!] must be used
500                         to overwrite it.
502                         When the [-ascii] argument is present, words with
503                         non-ascii characters are skipped.  The resulting file
504                         ends in "ascii.spl".
506                         The input can be the Myspell format files {inname}.aff
507                         and {inname}.dic.  If {inname}.aff does not exist then
508                         {inname} is used as the file name of a plain word
509                         list.
511                         Multiple {inname} arguments can be given to combine
512                         regions into one Vim spell file.  Example: >
513                 :mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU
514 <                       This combines the English word lists for US, CA and AU
515                         into one en.spl file.
516                         Up to eight regions can be combined. *E754* *E755*
517                         The REP and SAL items of the first .aff file where
518                         they appear are used. |spell-REP| |spell-SAL|
520                         This command uses a lot of memory, required to find
521                         the optimal word tree (Polish, Italian and Hungarian
522                         require several hundred Mbyte).  The final result will
523                         be much smaller, because compression is used.  To
524                         avoid running out of memory compression will be done
525                         now and then.  This can be tuned with the 'mkspellmem'
526                         option.
528                         After the spell file was written and it was being used
529                         in a buffer it will be reloaded automatically.
531 :mksp[ell] [-ascii] {name}.{enc}.add
532                         Like ":mkspell" above, using {name}.{enc}.add as the
533                         input file and producing an output file in the same
534                         directory that has ".spl" appended.
536 :mksp[ell] [-ascii] {name}
537                         Like ":mkspell" above, using {name} as the input file
538                         and producing an output file in the same directory
539                         that has ".{enc}.spl" appended.
541 Vim will report the number of duplicate words.  This might be a mistake in the
542 list of words.  But sometimes it is used to have different prefixes and
543 suffixes for the same basic word to avoid them combining (e.g. Czech uses
544 this).  If you want Vim to report all duplicate words set the 'verbose'
545 option.
547 Since you might want to change a Myspell word list for use with Vim the
548 following procedure is recommended:
550 1. Obtain the xx_YY.aff and xx_YY.dic files from Myspell.
551 2. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic.
552 3. Change the xx_YY.aff and xx_YY.dic files to remove bad words, add missing
553    words, define word characters with FOL/LOW/UPP, etc.  The distributed
554    "*.diff" files can be used.
555 4. Start Vim with the right locale and use |:mkspell| to generate the Vim
556    spell file.
557 5. Try out the spell file with ":set spell spelllang=xx" if you wrote it in
558    a spell directory in 'runtimepath', or ":set spelllang=xx.enc.spl" if you
559    wrote it somewhere else.
561 When the Myspell files are updated you can merge the differences:
562 1. Obtain the new Myspell files as xx_YY.new.aff and xx_UU.new.dic.
563 2. Use Vimdiff to see what changed: >
564         vimdiff xx_YY.orig.dic xx_YY.new.dic
565 3. Take over the changes you like in xx_YY.dic.
566    You may also need to change xx_YY.aff.
567 4. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.new.aff.
570 SPELL FILE VERSIONS                                     *E770* *E771* *E772*
572 Spell checking is a relatively new feature in Vim, thus it's possible that the
573 .spl file format will be changed to support more languages.  Vim will check
574 the validity of the spell file and report anything wrong.
576         E771: Old spell file, needs to be updated ~
577 This spell file is older than your Vim.  You need to update the .spl file.
579         E772: Spell file is for newer version of Vim ~
580 This means the spell file was made for a later version of Vim.  You need to
581 update Vim.
583         E770: Unsupported section in spell file ~
584 This means the spell file was made for a later version of Vim and contains a
585 section that is required for the spell file to work.  In this case it's
586 probably a good idea to upgrade your Vim.
589 SPELL FILE DUMP
591 If for some reason you want to check what words are supported by the currently
592 used spelling files, use this command:
594                                                         *:spelldump* *:spelld*
595 :spelld[ump]            Open a new window and fill it with all currently valid
596                         words.  Compound words are not included.
597                         Note: For some languages the result may be enormous,
598                         causing Vim to run out of memory.
600 :spelld[ump]!           Like ":spelldump" and include the word count.  This is
601                         the number of times the word was found while
602                         updating the screen.  Words that are in COMMON items
603                         get a starting count of 10.
605 The format of the word list is used |spell-wordlist-format|.  You should be
606 able to read it with ":mkspell" to generate one .spl file that includes all
607 the words.
609 When all entries to 'spelllang' use the same regions or no regions at all then
610 the region information is included in the dumped words.  Otherwise only words
611 for the current region are included and no "/regions" line is generated.
613 Comment lines with the name of the .spl file are used as a header above the
614 words that were generated from that .spl file.
617 SPELL FILE MISSING              *spell-SpellFileMissing* *spellfile.vim*
619 If the spell file for the language you are using is not available, you will
620 get an error message.  But if the "spellfile.vim" plugin is active it will
621 offer you to download the spell file.  Just follow the instructions, it will
622 ask you where to write the file (there must be a writable directory in
623 'runtimepath' for this).
625 The plugin has a default place where to look for spell files, on the Vim ftp
626 server.  If you want to use another location or another protocol, set the
627 g:spellfile_URL variable to the directory that holds the spell files.  The
628 |netrw| plugin is used for getting the file, look there for the specific
629 syntax of the URL.  Example: >
630         let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
631 You may need to escape special characters.
633 The plugin will only ask about downloading a language once.  If you want to
634 try again anyway restart Vim, or set g:spellfile_URL to another value (e.g.,
635 prepend a space).
637 To avoid using the "spellfile.vim" plugin do this in your vimrc file: >
639         let loaded_spellfile_plugin = 1
641 Instead of using the plugin you can define a |SpellFileMissing| autocommand to
642 handle the missing file yourself.  You can use it like this: >
644         :au SpellFileMissing * call Download_spell_file(expand('<amatch>'))
646 Thus the <amatch> item contains the name of the language.  Another important
647 value is 'encoding', since every encoding has its own spell file.  With two
648 exceptions:
649 - For ISO-8859-15 (latin9) the name "latin1" is used (the encodings only
650   differ in characters not used in dictionary words).
651 - The name "ascii" may also be used for some languages where the words use
652   only ASCII letters for most of the words.
654 The default "spellfile.vim" plugin uses this autocommand, if you define your
655 autocommand afterwards you may want to use ":au! SpellFileMissing" to overrule
656 it.  If you define your autocommand before the plugin is loaded it will notice
657 this and not do anything.
658                                                         *E797*
659 Note that the SpellFileMissing autocommand must not change or destroy the
660 buffer the user was editing.
662 ==============================================================================
663 4. Spell file format                                    *spell-file-format*
665 This is the format of the files that are used by the person who creates and
666 maintains a word list.
668 Note that we avoid the word "dictionary" here.  That is because the goal of
669 spell checking differs from writing a dictionary (as in the book).  For
670 spelling we need a list of words that are OK, thus should not be highlighted.
671 Person and company names will not appear in a dictionary, but do appear in a
672 word list.  And some old words are rarely used while they are common
673 misspellings.  These do appear in a dictionary but not in a word list.
675 There are two formats: A straight list of words and a list using affix
676 compression.  The files with affix compression are used by Myspell (Mozilla
677 and OpenOffice.org).  This requires two files, one with .aff and one with .dic
678 extension.
681 FORMAT OF STRAIGHT WORD LIST                            *spell-wordlist-format*
683 The words must appear one per line.  That is all that is required.
685 Additionally the following items are recognized:
687 - Empty and blank lines are ignored.
689         # comment ~
690 - Lines starting with a # are ignored (comment lines).
692         /encoding=utf-8 ~
693 - A line starting with "/encoding=", before any word, specifies the encoding
694   of the file.  After the second '=' comes an encoding name.  This tells Vim
695   to setup conversion from the specified encoding to 'encoding'.  Thus you can
696   use one word list for several target encodings.
698         /regions=usca ~
699 - A line starting with "/regions=" specifies the region names that are
700   supported.  Each region name must be two ASCII letters.  The first one is
701   region 1.  Thus "/regions=usca" has region 1 "us" and region 2 "ca".
702   In an addition word list the region names should be equal to the main word
703   list!
705 - Other lines starting with '/' are reserved for future use.  The ones that
706   are not recognized are ignored.  You do get a warning message, so that you
707   know something won't work.
709 - A "/" may follow the word with the following items:
710     =           Case must match exactly.
711     ?           Rare word.
712     !           Bad (wrong) word.
713     digit       A region in which the word is valid.  If no regions are
714                 specified the word is valid in all regions.
716 Example:
718         # This is an example word list          comment
719         /encoding=latin1                        encoding of the file
720         /regions=uscagb                         regions "us", "ca" and "gb"
721         example                                 word for all regions
722         blah/12                                 word for regions "us" and "ca"
723         vim/!                                   bad word
724         Campbell/?3                             rare word in region 3 "gb"
725         's mornings/=                           keep-case word
727 Note that when "/=" is used the same word with all upper-case letters is not
728 accepted.  This is different from a word with mixed case that is automatically
729 marked as keep-case, those words may appear in all upper-case letters.
732 FORMAT WITH .AFF AND .DIC FILES                         *aff-dic-format*
734 There are two files: the basic word list and an affix file.  The affix file
735 specifies settings for the language and can contain affixes.  The affixes are
736 used to modify the basic words to get the full word list.  This significantly
737 reduces the number of words, especially for a language like Polish.  This is
738 called affix compression.
740 The basic word list and the affix file are combined with the ":mkspell"
741 command and results in a binary spell file.  All the preprocessing has been
742 done, thus this file loads fast.  The binary spell file format is described in
743 the source code (src/spell.c).  But only developers need to know about it.
745 The preprocessing also allows us to take the Myspell language files and modify
746 them before the Vim word list is made.  The tools for this can be found in the
747 "src/spell" directory.
749 The format for the affix and word list files is based on what Myspell uses
750 (the spell checker of Mozilla and OpenOffice.org).  A description can be found
751 here:
752         http://lingucomponent.openoffice.org/affix.readme ~
753 Note that affixes are case sensitive, this isn't obvious from the description.
755 Vim supports quite a few extras.  They are described below |spell-affix-vim|.
756 Attempts have been made to keep this compatible with other spell checkers, so
757 that the same files can often be used.  One other project that offers more
758 than Myspell is Hunspell ( http://hunspell.sf.net ).
761 WORD LIST FORMAT                                *spell-dic-format*
763 A short example, with line numbers:
765         1       1234 ~
766         2       aan ~
767         3       Als ~
768         4       Etten-Leur ~
769         5       et al. ~
770         6       's-Gravenhage ~
771         7       's-Gravenhaags ~
772         8       # word that differs between regions ~
773         9       kado/1 ~
774         10      cadeau/2 ~
775         11      TCP,IP ~
776         12      /the S affix may add a 's' ~
777         13      bedel/S ~
779 The first line contains the number of words.  Vim ignores it, but you do get
780 an error message if it's not there.  *E760*
782 What follows is one word per line.  White space at the end of the line is
783 ignored, all other white space matters.  The encoding is specified in the
784 affix file |spell-SET|.
786 Comment lines start with '#' or '/'.  See the example lines 8 and 12.  Note
787 that putting a comment after a word is NOT allowed:
789                 someword   # comment that causes an error! ~
791 After the word there is an optional slash and flags.  Most of these flags are
792 letters that indicate the affixes that can be used with this word.  These are
793 specified with SFX and PFX lines in the .aff file, see |spell-SFX| and
794 |spell-PFX|.  Vim allows using other flag types with the FLAG item in the
795 affix file |spell-FLAG|.
797 When the word only has lower-case letters it will also match with the word
798 starting with an upper-case letter.
800 When the word includes an upper-case letter, this means the upper-case letter
801 is required at this position.  The same word with a lower-case letter at this
802 position will not match. When some of the other letters are upper-case it will
803 not match either.
805 The word with all upper-case characters will always be OK,
807         word list       matches                 does not match ~
808         als             als Als ALS             ALs AlS aLs aLS
809         Als             Als  ALS                als ALs AlS aLs aLS
810         ALS             ALS                     als Als ALs AlS aLs aLS
811         AlS             AlS ALS                 als Als ALs aLs aLS
813 The KEEPCASE affix ID can be used to specifically match a word with identical
814 case only, see below |spell-KEEPCASE|.
816 Note: in line 5 to 7 non-word characters are used.  You can include any
817 character in a word.  When checking the text a word still only matches when it
818 appears with a non-word character before and after it.  For Myspell a word
819 starting with a non-word character probably won't work.
821 In line 12 the word "TCP/IP" is defined.  Since the slash has a special
822 meaning the comma is used instead.  This is defined with the SLASH item in the
823 affix file, see |spell-SLASH|.  Note that without this SLASH item the word
824 will be "TCP,IP".
827 AFFIX FILE FORMAT                       *spell-aff-format* *spell-affix-vim*
829                                                         *spell-affix-comment*
830 Comment lines in the .aff file start with a '#':
832         # comment line ~
834 Items with a fixed number of arguments can be followed by a comment.  But only
835 if none of the arguments can contain white space.  The comment must start with
836 a "#" character.  Example:
838         KEEPCASE =  # fix case for words with this flag ~
841 ENCODING                                                        *spell-SET*
843 The affix file can be in any encoding that is supported by "iconv".  However,
844 in some cases the current locale should also be set properly at the time
845 |:mkspell| is invoked.  Adding FOL/LOW/UPP lines removes this requirement
846 |spell-FOL|.
848 The encoding should be specified before anything where the encoding matters.
849 The encoding applies both to the affix file and the dictionary file.  It is
850 done with a SET line:
852         SET utf-8 ~
854 The encoding can be different from the value of the 'encoding' option at the
855 time ":mkspell" is used.  Vim will then convert everything to 'encoding' and
856 generate a spell file for 'encoding'.  If some of the used characters to not
857 fit in 'encoding' you will get an error message.
858                                                         *spell-affix-mbyte*
859 When using a multi-byte encoding it's possible to use more different affix
860 flags.  But Myspell doesn't support that, thus you may not want to use it
861 anyway.  For compatibility use an 8-bit encoding.
864 INFORMATION
866 These entries in the affix file can be used to add information to the spell
867 file.  There are no restrictions on the format, but they should be in the
868 right encoding.
870                                 *spell-NAME* *spell-VERSION* *spell-HOME*
871                                 *spell-AUTHOR* *spell-EMAIL* *spell-COPYRIGHT*
872         NAME            Name of the language
873         VERSION         1.0.1  with fixes
874         HOME            http://www.myhome.eu
875         AUTHOR          John Doe
876         EMAIL           john AT Doe DOT net
877         COPYRIGHT       LGPL
879 These fields are put in the .spl file as-is.  The |:spellinfo| command can be
880 used to view the info.
882                                                         *:spellinfo* *:spelli*
883 :spelli[nfo]            Display the information for the spell file(s) used for
884                         the current buffer.
887 CHARACTER TABLES
888                                                         *spell-affix-chars*
889 When using an 8-bit encoding the affix file should define what characters are
890 word characters.  This is because the system where ":mkspell" is used may not
891 support a locale with this encoding and isalpha() won't work.  For example
892 when using "cp1250" on Unix.
893                                                 *E761* *E762* *spell-FOL*
894                                                 *spell-LOW* *spell-UPP*
895 Three lines in the affix file are needed.  Simplistic example:
897         FOL  áëñ ~
898         LOW  áëñ ~
899         UPP  ÁËÑ ~
901 All three lines must have exactly the same number of characters.
903 The "FOL" line specifies the case-folded characters.  These are used to
904 compare words while ignoring case.  For most encodings this is identical to
905 the lower case line.
907 The "LOW" line specifies the characters in lower-case.  Mostly it's equal to
908 the "FOL" line.
910 The "UPP" line specifies the characters with upper-case.  That is, a character
911 is upper-case where it's different from the character at the same position in
912 "FOL".
914 An exception is made for the German sharp s ß.  The upper-case version is
915 "SS".  In the FOL/LOW/UPP lines it should be included, so that it's recognized
916 as a word character, but use the ß character in all three.
918 ASCII characters should be omitted, Vim always handles these in the same way.
919 When the encoding is UTF-8 no word characters need to be specified.
921                                                         *E763*
922 Vim allows you to use spell checking for several languages in the same file.
923 You can list them in the 'spelllang' option.  As a consequence all spell files
924 for the same encoding must use the same word characters, otherwise they can't
925 be combined without errors.  If you get a warning that the word tables differ
926 you may need to generate the .spl file again with |:mkspell|.  Check the FOL,
927 LOW and UPP lines in the used .aff file.
929 The XX.ascii.spl spell file generated with the "-ascii" argument will not
930 contain the table with characters, so that it can be combine with spell files
931 for any encoding.  The .add.spl files also do not contain the table.
934 MID-WORD CHARACTERS
935                                                         *spell-midword*
936 Some characters are only to be considered word characters if they are used in
937 between two ordinary word characters.  An example is the single quote: It is
938 often used to put text in quotes, thus it can't be recognized as a word
939 character, but when it appears in between word characters it must be part of
940 the word.  This is needed to detect a spelling error such as they'are.  That
941 should be they're, but since "they" and "are" are words themselves that would
942 go unnoticed.
944 These characters are defined with MIDWORD in the .aff file.  Example:
946         MIDWORD '- ~
949 FLAG TYPES                                              *spell-FLAG*
951 Flags are used to specify the affixes that can be used with a word and for
952 other properties of the word.  Normally single-character flags are used.  This
953 limits the number of possible flags, especially for 8-bit encodings.  The FLAG
954 item can be used if more affixes are to be used.  Possible values:
956         FLAG long       use two-character flags
957         FLAG num        use numbers, from 1 up to 65000
958         FLAG caplong    use one-character flags without A-Z and two-character
959                         flags that start with A-Z
961 With "FLAG num" the numbers in a list of affixes need to be separated with a
962 comma: "234,2143,1435".  This method is inefficient, but useful if the file is
963 generated with a program.
965 When using "caplong" the two-character flags all start with a capital: "Aa",
966 "B1", "BB", etc.  This is useful to use one-character flags for the most
967 common items and two-character flags for uncommon items.
969 Note: When using utf-8 only characters up to 65000 may be used for flags.
971 Note: even when using "num" or "long" the number of flags available to
972 compounding and prefixes is limited to about 250.
975 AFFIXES
976                                             *spell-PFX* *spell-SFX*
977 The usual PFX (prefix) and SFX (suffix) lines are supported (see the Myspell
978 documentation or the Aspell manual:
979 http://aspell.net/man-html/Affix-Compression.html).
981 Summary:
982         SFX L Y 2 ~
983         SFX L 0 re [^x] ~
984         SFX L 0 ro x ~
986 The first line is a header and has four fields:
987         SFX {flag} {combine} {count}
989 {flag}          The name used for the suffix.  Mostly it's a single letter,
990                 but other characters can be used, see |spell-FLAG|.
992 {combine}       Can be 'Y' or 'N'.  When 'Y' then the word plus suffix can
993                 also have a prefix.  When 'N' then a prefix is not allowed.
995 {count}         The number of lines following.  If this is wrong you will get
996                 an error message.
998 For PFX the fields are exactly the same.
1000 The basic format for the following lines is:
1001         SFX {flag} {strip} {add} {condition} {extra}
1003 {flag}          Must be the same as the {flag} used in the first line.
1005 {strip}         Characters removed from the basic word.  There is no check if
1006                 the characters are actually there, only the length is used (in
1007                 bytes).  This better match the {condition}, otherwise strange
1008                 things may happen.  If the {strip} length is equal to or
1009                 longer than the basic word the suffix won't be used.
1010                 When {strip} is 0 (zero) then nothing is stripped.
1012 {add}           Characters added to the basic word, after removing {strip}.
1013                 Optionally there is a '/' followed by flags.  The flags apply
1014                 to the word plus affix.  See |spell-affix-flags|
1016 {condition}     A simplistic pattern.  Only when this matches with a basic
1017                 word will the suffix be used for that word.  This is normally
1018                 for using one suffix letter with different {add} and {strip}
1019                 fields for words with different endings.
1020                 When {condition} is a . (dot) there is no condition.
1021                 The pattern may contain:
1022                 - Literal characters.
1023                 - A set of characters in []. [abc] matches a, b and c.
1024                   A dash is allowed for a range [a-c], but this is
1025                   Vim-specific.
1026                 - A set of characters that starts with a ^, meaning the
1027                   complement of the specified characters. [^abc] matches any
1028                   character but a, b and c.
1030 {extra}         Optional extra text:
1031                     # comment           Comment is ignored
1032                     -                   Hunspell uses this, ignored
1034 For PFX the fields are the same, but the {strip}, {add} and {condition} apply
1035 to the start of the word.
1037 Note: Myspell ignores any extra text after the relevant info.  Vim requires
1038 this text to start with a "#" so that mistakes don't go unnoticed.  Example:
1040         SFX F 0 in   [^i]n      # Spion > Spionin  ~
1041         SFX F 0 nen  in         # Bauerin > Bauerinnen ~
1043 Apparently Myspell allows an affix name to appear more than once.  Since this
1044 might also be a mistake, Vim checks for an extra "S".  The affix files for
1045 Myspell that use this feature apparently have this flag.  Example:
1047         SFX a Y 1 S ~
1048         SFX a 0 an . ~
1050         SFX a Y 2 S ~
1051         SFX a 0 en . ~
1052         SFX a 0 on . ~
1055 AFFIX FLAGS                                             *spell-affix-flags*
1057 This is a feature that comes from Hunspell: The affix may specify flags.  This
1058 works similar to flags specified on a basic word.  The flags apply to the
1059 basic word plus the affix (but there are restrictions).  Example:
1061         SFX S Y 1 ~
1062         SFX S 0 s . ~
1064         SFX A Y 1 ~
1065         SFX A 0 able/S . ~
1067 When the dictionary file contains "drink/AS" then these words are possible:
1069         drink
1070         drinks          uses S suffix
1071         drinkable       uses A suffix
1072         drinkables      uses A suffix and then S suffix
1074 Generally the flags of the suffix are added to the flags of the basic word,
1075 both are used for the word plus suffix.  But the flags of the basic word are
1076 only used once for affixes, except that both one prefix and one suffix can be
1077 used when both support combining.
1079 Specifically, the affix flags can be used for:
1080 - Suffixes on suffixes, as in the example above.  This works once, thus you
1081   can have two suffixes on a word (plus one prefix).
1082 - Making the word with the affix rare, by using the |spell-RARE| flag.
1083 - Exclude the word with the affix from compounding, by using the
1084   |spell-COMPOUNDFORBIDFLAG| flag.
1085 - Allow the word with the affix to be part of a compound word on the side of
1086   the affix with the |spell-COMPOUNDPERMITFLAG|.
1087 - Use the NEEDCOMPOUND flag: word plus affix can only be used as part of a
1088   compound word. |spell-NEEDCOMPOUND|
1089 - Compound flags: word plus affix can be part of a compound word at the end,
1090   middle, start, etc.  The flags are combined with the flags of the basic
1091   word.  |spell-compound|
1092 - NEEDAFFIX: another affix is needed to make a valid word.
1093 - CIRCUMFIX, as explained just below.
1096 CIRCUMFIX                                               *spell-CIRCUMFIX*
1098 The CIRCUMFIX flag means a prefix and suffix must be added at the same time.
1099 If a prefix has the CIRCUMFIX flag than only suffixes with the CIRCUMFIX flag
1100 can be added, and the other way around.
1101 An alternative is to only specify the suffix, and give the that suffix two
1102 flags: The required prefix and the NEEDAFFIX flag.  |spell-NEEDAFFIX|
1105 PFXPOSTPONE                                             *spell-PFXPOSTPONE*
1107 When an affix file has very many prefixes that apply to many words it's not
1108 possible to build the whole word list in memory.  This applies to Hebrew (a
1109 list with all words is over a Gbyte).  In that case applying prefixes must be
1110 postponed.  This makes spell checking slower.  It is indicated by this keyword
1111 in the .aff file:
1113         PFXPOSTPONE ~
1115 Only prefixes without a chop string and without flags can be postponed.
1116 Prefixes with a chop string or with flags will still be included in the word
1117 list.  An exception if the chop string is one character and equal to the last
1118 character of the added string, but in lower case.  Thus when the chop string
1119 is used to allow the following word to start with an upper case letter.
1122 WORDS WITH A SLASH                                      *spell-SLASH*
1124 The slash is used in the .dic file to separate the basic word from the affix
1125 letters and other flags.  Unfortunately, this means you cannot use a slash in
1126 a word.  Thus "TCP/IP" is not a word but "TCP with the flags "IP".  To include
1127 a slash in the word put a backslash before it: "TCP\/IP".  In the rare case
1128 you want to use a backslash inside a word you need to use two backslashes.
1129 Any other use of the backslash is reserved for future expansion.
1132 KEEP-CASE WORDS                                         *spell-KEEPCASE*
1134 In the affix file a KEEPCASE line can be used to define the affix name used
1135 for keep-case words.  Example:
1137         KEEPCASE = ~
1139 This flag is not supported by Myspell.  It has the meaning that case matters.
1140 This can be used if the word does not have the first letter in upper case at
1141 the start of a sentence.  Example:
1143     word list       matches                 does not match ~
1144     's morgens/=    's morgens              'S morgens 's Morgens 'S MORGENS
1145     's Morgens      's Morgens 'S MORGENS   'S morgens 's morgens
1147 The flag can also be used to avoid that the word matches when it is in all
1148 upper-case letters.
1151 RARE WORDS                                              *spell-RARE*
1153 In the affix file a RARE line can be used to define the affix name used for
1154 rare words.  Example:
1156         RARE ? ~
1158 Rare words are highlighted differently from bad words.  This is to be used for
1159 words that are correct for the language, but are hardly ever used and could be
1160 a typing mistake anyway.  When the same word is found as good it won't be
1161 highlighted as rare.
1163 This flag can also be used on an affix, so that a basic word is not rare but
1164 the basic word plus affix is rare |spell-affix-flags|.  However, if the word
1165 also appears as a good word in another way (e.g., in another region) it won't
1166 be marked as rare.
1169 BAD WORDS                                               *spell-BAD*
1171 In the affix file a BAD line can be used to define the affix name used for
1172 bad words.  Example:
1174         BAD ! ~
1176 This can be used to exclude words that would otherwise be good.  For example
1177 "the the" in the .dic file:
1179         the the/! ~
1181 Once a word has been marked as bad it won't be undone by encountering the same
1182 word as good.
1184 The flag also applies to the word with affixes, thus this can be used to mark
1185 a whole bunch of related words as bad.
1187                                                         *spell-FORBIDDENWORD*
1188 FORBIDDENWORD can be used just like BAD.  For compatibility with Hunspell.
1190                                                         *spell-NEEDAFFIX*
1191 The NEEDAFFIX flag is used to require that a word is used with an affix.  The
1192 word itself is not a good word (unless there is an empty affix).  Example:
1194         NEEDAFFIX + ~
1197 COMPOUND WORDS                                          *spell-compound*
1199 A compound word is a longer word made by concatenating words that appear in
1200 the .dic file.  To specify which words may be concatenated a character is
1201 used.  This character is put in the list of affixes after the word.  We will
1202 call this character a flag here.  Obviously these flags must be different from
1203 any affix IDs used.
1205                                                         *spell-COMPOUNDFLAG*
1206 The Myspell compatible method uses one flag, specified with COMPOUNDFLAG.  All
1207 words with this flag combine in any order.  This means there is no control
1208 over which word comes first.  Example:
1209         COMPOUNDFLAG c ~
1211                                                         *spell-COMPOUNDRULE*
1212 A more advanced method to specify how compound words can be formed uses
1213 multiple items with multiple flags.  This is not compatible with Myspell 3.0.
1214 Let's start with an example:
1215         COMPOUNDRULE c+ ~
1216         COMPOUNDRULE se ~
1218 The first line defines that words with the "c" flag can be concatenated in any
1219 order.  The second line defines compound words that are made of one word with
1220 the "s" flag and one word with the "e" flag.  With this dictionary:
1221         bork/c ~
1222         onion/s ~
1223         soup/e ~
1225 You can make these words:
1226         bork
1227         borkbork
1228         borkborkbork
1229         (etc.)
1230         onion
1231         soup
1232         onionsoup
1234 The COMPOUNDRULE item may appear multiple times.  The argument is made out of
1235 one or more groups, where each group can be:
1236         one flag                        e.g., c
1237         alternate flags inside []       e.g., [abc]
1238 Optionally this may be followed by:
1239         *       the group appears zero or more times, e.g., sm*e
1240         +       the group appears one or more times, e.g., c+
1242 This is similar to the regexp pattern syntax (but not the same!).  A few
1243 examples with the sequence of word flags they require:
1244     COMPOUNDRULE x+         x xx xxx etc.
1245     COMPOUNDRULE yz         yz
1246     COMPOUNDRULE x+z        xz xxz xxxz etc.
1247     COMPOUNDRULE yx+        yx yxx yxxx etc.
1249     COMPOUNDRULE [abc]z    az bz cz
1250     COMPOUNDRULE [abc]+z   az aaz abaz bz baz bcbz cz caz cbaz etc.
1251     COMPOUNDRULE a[xyz]+   ax axx axyz ay ayx ayzz az azy azxy etc.
1252     COMPOUNDRULE sm*e       se sme smme smmme etc.
1253     COMPOUNDRULE s[xyz]*e  se sxe sxye sxyxe sye syze sze szye szyxe  etc.
1255 A specific example: Allow a compound to be made of two words and a dash:
1256         In the .aff file:
1257             COMPOUNDRULE sde ~
1258             NEEDAFFIX x ~
1259             COMPOUNDWORDMAX 3 ~
1260             COMPOUNDMIN 1 ~
1261         In the .dic file:
1262             start/s ~
1263             end/e ~
1264             -/xd ~
1266 This allows for the word "start-end", but not "startend".
1268 An additional implied rule is that, without further flags, a word with a
1269 prefix cannot be compounded after another word, and a word with a suffix
1270 cannot be compounded with a following word.  Thus the affix cannot appear
1271 on the inside of a compound word.  This can be changed with the
1272 |spell-COMPOUNDPERMITFLAG|.
1274                                                         *spell-NEEDCOMPOUND*
1275 The NEEDCOMPOUND flag is used to require that a word is used as part of a
1276 compound word.  The word itself is not a good word.  Example:
1278         NEEDCOMPOUND & ~
1280                                                         *spell-ONLYINCOMPOUND*
1281 The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND.  Supported for
1282 compatibility with Hunspell.
1284                                                         *spell-COMPOUNDMIN*
1285 The minimal character length of a word used for compounding is specified with
1286 COMPOUNDMIN.  Example:
1287         COMPOUNDMIN 5 ~
1289 When omitted there is no minimal length.  Obviously you could just leave out
1290 the compound flag from short words instead, this feature is present for
1291 compatibility with Myspell.
1293                                                         *spell-COMPOUNDWORDMAX*
1294 The maximum number of words that can be concatenated into a compound word is
1295 specified with COMPOUNDWORDMAX.  Example:
1296         COMPOUNDWORDMAX 3 ~
1298 When omitted there is no maximum.  It applies to all compound words.
1300 To set a limit for words with specific flags make sure the items in
1301 COMPOUNDRULE where they appear don't allow too many words.
1303                                                         *spell-COMPOUNDSYLMAX*
1304 The maximum number of syllables that a compound word may contain is specified
1305 with COMPOUNDSYLMAX.  Example:
1306         COMPOUNDSYLMAX 6 ~
1308 This has no effect if there is no SYLLABLE item.  Without COMPOUNDSYLMAX there
1309 is no limit on the number of syllables.
1311 If both COMPOUNDWORDMAX and COMPOUNDSYLMAX are defined, a compound word is
1312 accepted if it fits one of the criteria, thus is either made from up to
1313 COMPOUNDWORDMAX words or contains up to COMPOUNDSYLMAX syllables.
1315                                                     *spell-COMPOUNDFORBIDFLAG*
1316 The COMPOUNDFORBIDFLAG specifies a flag that can be used on an affix.  It
1317 means that the word plus affix cannot be used in a compound word.  Example:
1318         affix file:
1319                 COMPOUNDFLAG c ~
1320                 COMPOUNDFORBIDFLAG x ~
1321                 SFX a Y 2 ~
1322                 SFX a 0 s   . ~
1323                 SFX a 0 ize/x . ~
1324         dictionary:
1325                 word/c ~
1326                 util/ac ~
1328 This allows for "wordutil" and "wordutils" but not "wordutilize".
1329 Note: this doesn't work for postponed prefixes yet.
1331                                                     *spell-COMPOUNDPERMITFLAG*
1332 The COMPOUNDPERMITFLAG specifies a flag that can be used on an affix.  It
1333 means that the word plus affix can also be used in a compound word in a way
1334 where the affix ends up halfway the word.  Without this flag that is not
1335 allowed.
1336 Note: this doesn't work for postponed prefixes yet.
1338                                                     *spell-COMPOUNDROOT*
1339 The COMPOUNDROOT flag is used for words in the dictionary that are already a
1340 compound.  This means it counts for two words when checking the compounding
1341 rules.  Can also be used for an affix to count the affix as a compounding
1342 word.
1344                                                 *spell-CHECKCOMPOUNDPATTERN*
1345 CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
1346 position where two words are compounded together forbids the compound.
1347 For example:
1348         CHECKCOMPOUNDPATTERN o e ~
1350 This forbids compounding if the first word ends in "o" and the second word
1351 starts with "e".
1353 The arguments must be plain text, no patterns are actually supported, despite
1354 the item name.  Case is always ignored.
1356 The Hunspell feature to use three arguments and flags is not supported.
1358                                                         *spell-SYLLABLE*
1359 The SYLLABLE item defines characters or character sequences that are used to
1360 count the number of syllables in a word.  Example:
1361         SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~
1363 Before the first slash is the set of characters that are counted for one
1364 syllable, also when repeated and mixed, until the next character that is not
1365 in this set.  After the slash come sequences of characters that are counted
1366 for one syllable.  These are preferred over using characters from the set.
1367 With the example "ideeen" has three syllables, counted by "i", "ee" and "e".
1369 Only case-folded letters need to be included.
1371 Another way to restrict compounding was mentioned above: Adding the
1372 |spell-COMPOUNDFORBIDFLAG| flag to an affix causes all words that are made
1373 with that affix not be be used for compounding.
1376 UNLIMITED COMPOUNDING                                   *spell-NOBREAK*
1378 For some languages, such as Thai, there is no space in between words.  This
1379 looks like all words are compounded.  To specify this use the NOBREAK item in
1380 the affix file, without arguments:
1381         NOBREAK ~
1383 Vim will try to figure out where one word ends and a next starts.  When there
1384 are spelling mistakes this may not be quite right.
1387                                                         *spell-COMMON*
1388 Common words can be specified with the COMMON item.  This will give better
1389 suggestions when editing a short file.  Example:
1391         COMMON  the of to and a in is it you that he was for on are ~
1393 The words must be separated by white space, up to 25 per line.
1394 When multiple regions are specified in a ":mkspell" command the common words
1395 for all regions are combined and used for all regions.
1397                                                         *spell-NOSPLITSUGS*
1398 This item indicates that splitting a word to make suggestions is not a good
1399 idea.  Split-word suggestions will appear only when there are few similar
1400 words.
1402         NOSPLITSUGS ~
1404                                                         *spell-NOSUGGEST*
1405 The flag specified with NOSUGGEST can be used for words that will not be
1406 suggested.  Can be used for obscene words.
1408         NOSUGGEST % ~
1411 REPLACEMENTS                                            *spell-REP*
1413 In the affix file REP items can be used to define common mistakes.  This is
1414 used to make spelling suggestions.  The items define the "from" text and the
1415 "to" replacement.  Example:
1417         REP 4 ~
1418         REP f ph ~
1419         REP ph f ~
1420         REP k ch ~
1421         REP ch k ~
1423 The first line specifies the number of REP lines following.  Vim ignores the
1424 number, but it must be there (for compatibility with Myspell).
1426 Don't include simple one-character replacements or swaps.  Vim will try these
1427 anyway.  You can include whole words if you want to, but you might want to use
1428 the "file:" item in 'spellsuggest' instead.
1430 You can include a space by using an underscore:
1432         REP the_the the ~
1435 SIMILAR CHARACTERS                                      *spell-MAP* *E783*
1437 In the affix file MAP items can be used to define letters that are very much
1438 alike.  This is mostly used for a letter with different accents.  This is used
1439 to prefer suggestions with these letters substituted.  Example:
1441         MAP 2 ~
1442         MAP eéëêè ~
1443         MAP uüùúû ~
1445 The first line specifies the number of MAP lines following.  Vim ignores the
1446 number, but the line must be there.
1448 Each letter must appear in only one of the MAP items.  It's a bit more
1449 efficient if the first letter is ASCII or at least one without accents.
1452 .SUG FILE                                               *spell-NOSUGFILE*
1454 When soundfolding is specified in the affix file then ":mkspell" will normally
1455 produce a .sug file next to the .spl file.  This file is used to find
1456 suggestions by their sound-a-like form quickly.  At the cost of a lot of
1457 memory (the amount depends on the number of words, |:mkspell| will display an
1458 estimate when it's done).
1460 To avoid producing a .sug file use this item in the affix file:
1462         NOSUGFILE ~
1464 Users can simply omit the .sug file if they don't want to use it.
1467 SOUND-A-LIKE                                            *spell-SAL*
1469 In the affix file SAL items can be used to define the sounds-a-like mechanism
1470 to be used.  The main items define the "from" text and the "to" replacement.
1471 Simplistic example:
1473         SAL CIA                  X ~
1474         SAL CH                   X ~
1475         SAL C                    K ~
1476         SAL K                    K ~
1478 There are a few rules and this can become quite complicated.  An explanation
1479 how it works can be found in the Aspell manual:
1480 http://aspell.net/man-html/Phonetic-Code.html.
1482 There are a few special items:
1484         SAL followup            true ~
1485         SAL collapse_result     true ~
1486         SAL remove_accents      true ~
1488 "1" has the same meaning as "true".  Any other value means "false".
1491 SIMPLE SOUNDFOLDING                             *spell-SOFOFROM* *spell-SOFOTO*
1493 The SAL mechanism is complex and slow.  A simpler mechanism is mapping all
1494 characters to another character, mapping similar sounding characters to the
1495 same character.  At the same time this does case folding.  You can not have
1496 both SAL items and simple soundfolding.
1498 There are two items required: one to specify the characters that are mapped
1499 and one that specifies the characters they are mapped to.  They must have
1500 exactly the same number of characters.  Example:
1502     SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ~
1503     SOFOTO   ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkes ~
1505 In the example all vowels are mapped to the same character 'e'.  Another
1506 method would be to leave out all vowels.  Some characters that sound nearly
1507 the same and are often mixed up, such as 'm' and 'n', are mapped to the same
1508 character.  Don't do this too much, all words will start looking alike.
1510 Characters that do not appear in SOFOFROM will be left out, except that all
1511 white space is replaced by one space.  Sequences of the same character in
1512 SOFOFROM are replaced by one.
1514 You can use the |soundfold()| function to try out the results.  Or set the
1515 'verbose' option to see the score in the output of the |z=| command.
1518 UNSUPPORTED ITEMS                               *spell-affix-not-supported*
1520 These items appear in the affix file of other spell checkers.  In Vim they are
1521 ignored, not supported or defined in another way.
1523 ACCENT          (Hunspell)                              *spell-ACCENT*
1524                 Use MAP instead. |spell-MAP|
1526 BREAK           (Hunspell)                              *spell-BREAK*
1527                 Define break points.  Unclear how it works exactly.
1528                 Not supported.
1530 CHECKCOMPOUNDCASE  (Hunspell)                   *spell-CHECKCOMPOUNDCASE*
1531                 Disallow uppercase letters at compound word boundaries.
1532                 Not supported.
1534 CHECKCOMPOUNDDUP  (Hunspell)                    *spell-CHECKCOMPOUNDDUP*
1535                 Disallow using the same word twice in a compound.  Not
1536                 supported.
1538 CHECKCOMPOUNDREP  (Hunspell)                    *spell-CHECKCOMPOUNDREP*
1539                 Something about using REP items and compound words.  Not
1540                 supported.
1542 CHECKCOMPOUNDTRIPLE  (Hunspell)                 *spell-CHECKCOMPOUNDTRIPLE*
1543                 Forbid three identical characters when compounding.  Not
1544                 supported.
1546 COMPLEXPREFIXES  (Hunspell)                             *spell-COMPLEXPREFIXES*
1547                 Enables using two prefixes.  Not supported.
1549 COMPOUND        (Hunspell)                              *spell-COMPOUND*
1550                 This is one line with the count of COMPOUND items, followed by
1551                 that many COMPOUND lines with a pattern.
1552                 Remove the first line with the count and rename the other
1553                 items to COMPOUNDRULE |spell-COMPOUNDRULE|
1555 COMPOUNDFIRST   (Hunspell)                              *spell-COMPOUNDFIRST*
1556                 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1558 COMPOUNDBEGIN   (Hunspell)                              *spell-COMPOUNDBEGIN*
1559                 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1561 COMPOUNDEND     (Hunspell)                              *spell-COMPOUNDEND*
1562                 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1564 COMPOUNDMIDDLE  (Hunspell)                              *spell-COMPOUNDMIDDLE*
1565                 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1567 COMPOUNDRULES   (Hunspell)                              *spell-COMPOUNDRULES*
1568                 Number of COMPOUNDRULE lines following.  Ignored, but the
1569                 argument must be a number.
1571 COMPOUNDSYLLABLE  (Hunspell)                    *spell-COMPOUNDSYLLABLE*
1572                 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
1573                 |spell-COMPOUNDSYLMAX|
1575 KEY             (Hunspell)                              *spell-KEY*
1576                 Define characters that are close together on the keyboard.
1577                 Used to give better suggestions.  Not supported.
1578                 
1579 LANG            (Hunspell)                              *spell-LANG*
1580                 This specifies language-specific behavior.  This actually
1581                 moves part of the language knowledge into the program,
1582                 therefore Vim does not support it.  Each language property
1583                 must be specified separately.
1585 LEMMA_PRESENT   (Hunspell)                              *spell-LEMMA_PRESENT*
1586                 Only needed for morphological analysis.
1588 MAXNGRAMSUGS    (Hunspell)                              *spell-MAXNGRAMSUGS*
1589                 Set number of n-gram suggestions.  Not supported.
1591 PSEUDOROOT      (Hunspell)                              *spell-PSEUDOROOT*
1592                 Use NEEDAFFIX instead. |spell-NEEDAFFIX|
1594 SUGSWITHDOTS    (Hunspell)                              *spell-SUGSWITHDOTS*
1595                 Adds dots to suggestions.  Vim doesn't need this.
1597 SYLLABLENUM     (Hunspell)                              *spell-SYLLABLENUM*
1598                 Not supported.
1600 TRY             (Myspell, Hunspell, others)             *spell-TRY*
1601                 Vim does not use the TRY item, it is ignored.  For making
1602                 suggestions the actual characters in the words are used, that
1603                 is much more efficient.
1605 WORDCHARS       (Hunspell)                              *spell-WORDCHARS*
1606                 Used to recognize words.  Vim doesn't need it, because there
1607                 is no need to separate words before checking them (using a
1608                 trie instead of a hashtable).
1610  vim:tw=78:sw=4:ts=8:ft=help:norl: