blob: dea3adb87a995d8d2f928eb9038093036be1a6e5 [file] [log] [blame]
Christian Brabandtb4ddc6c2024-01-02 16:51:11 +01001*spell.txt* For Vim version 9.1. Last change: 2023 May 25
Bram Moolenaar217ad922005-03-20 22:37:15 +00002
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
7Spell checking *spell*
8
91. Quick start |spell-quickstart|
Bram Moolenaard042c562005-06-30 22:04:15 +0000102. Remarks on spell checking |spell-remarks|
113. Generating a spell file |spell-mkspell|
124. Spell file format |spell-file-format|
Bram Moolenaar217ad922005-03-20 22:37:15 +000013
Bram Moolenaar25c9c682019-05-05 18:13:34 +020014{not available when the |+syntax| feature has been disabled at compile time}
Bram Moolenaar217ad922005-03-20 22:37:15 +000015
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000016Note: There also is a vimspell plugin. If you have it you can do ":help
17vimspell" to find about it. But you will probably want to get rid of the
18plugin and use the 'spell' option instead, it works better.
19
Bram Moolenaar217ad922005-03-20 22:37:15 +000020==============================================================================
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000211. Quick start *spell-quickstart* *E756*
Bram Moolenaar217ad922005-03-20 22:37:15 +000022
23This command switches on spell checking: >
24
25 :setlocal spell spelllang=en_us
26
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000027This switches on the 'spell' option and specifies to check for US English.
Bram Moolenaar217ad922005-03-20 22:37:15 +000028
29The words that are not recognized are highlighted with one of these:
Bram Moolenaar520470a2005-06-16 21:59:56 +000030 SpellBad word not recognized |hl-SpellBad|
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +000031 SpellCap word not capitalised |hl-SpellCap|
Bram Moolenaar520470a2005-06-16 21:59:56 +000032 SpellRare rare word |hl-SpellRare|
33 SpellLocal wrong spelling for selected region |hl-SpellLocal|
Bram Moolenaar217ad922005-03-20 22:37:15 +000034
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000035Vim only checks words for spelling, there is no grammar check.
36
Bram Moolenaar45360022005-07-21 21:08:21 +000037If the 'mousemodel' option is set to "popup" and the cursor is on a badly
38spelled word or it is "popup_setpos" and the mouse pointer is on a badly
Bram Moolenaar16d8f872005-11-26 23:46:11 +000039spelled word, then the popup menu will contain a submenu to replace the bad
Bram Moolenaarf9393ef2006-04-24 19:47:27 +000040word. Note: this slows down the appearance of the popup menu. Note for GTK:
41don't release the right mouse button until the menu appears, otherwise it
42won't work.
Bram Moolenaar45360022005-07-21 21:08:21 +000043
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000044To search for the next misspelled word:
45
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000046 *]s*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000047]s Move to next misspelled word after the cursor.
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +000048 A count before the command can be used to repeat.
Bram Moolenaarac6e65f2005-08-29 22:25:38 +000049 'wrapscan' applies.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000050
51 *[s*
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +000052[s Like "]s" but search backwards, find the misspelled
Bram Moolenaar30abd282005-06-22 22:35:10 +000053 word before the cursor. Doesn't recognize words
54 split over two lines, thus may stop at words that are
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000055 not highlighted as bad. Does not stop at word with
56 missing capital at the start of a line.
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +000057
58 *]S*
59]S Like "]s" but only stop at bad words, not at rare
60 words or words for another region.
61
62 *[S*
63[S Like "]S" but search backwards.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000064
Bram Moolenaar217ad922005-03-20 22:37:15 +000065
Bram Moolenaarf75a9632005-09-13 21:20:47 +000066To add words to your own word list:
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000067
68 *zg*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000069zg Add word under the cursor as a good word to the first
Bram Moolenaarda2303d2005-08-30 21:55:26 +000070 name in 'spellfile'. A count may precede the command
71 to indicate the entry in 'spellfile' to be used. A
72 count of two uses the second entry.
73
74 In Visual mode the selected characters are added as a
75 word (including white space!).
76 When the cursor is on text that is marked as badly
77 spelled then the marked text is used.
78 Otherwise the word under the cursor, separated by
79 non-word characters, is used.
80
81 If the word is explicitly marked as bad word in
82 another spell file the result is unpredictable.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000083
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000084 *zG*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000085zG Like "zg" but add the word to the internal word list
86 |internal-wordlist|.
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000087
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000088 *zw*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000089zw Like "zg" but mark the word as a wrong (bad) word.
Bram Moolenaar87b5ca52006-03-04 21:55:31 +000090 If the word already appears in 'spellfile' it is
91 turned into a comment line. See |spellfile-cleanup|
92 for getting rid of those.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000093
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000094 *zW*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000095zW Like "zw" but add the word to the internal word list
96 |internal-wordlist|.
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000097
Bram Moolenaar87b5ca52006-03-04 21:55:31 +000098zuw *zug* *zuw*
99zug Undo |zw| and |zg|, remove the word from the entry in
100 'spellfile'. Count used as with |zg|.
101
102zuW *zuG* *zuW*
103zuG Undo |zW| and |zG|, remove the word from the internal
104 word list. Count used as with |zg|.
105
Bram Moolenaar2ecbe532022-07-29 21:36:21 +0100106 *:spe* *:spellgood* *E1280*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000107:[count]spe[llgood] {word}
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000108 Add {word} as a good word to 'spellfile', like with
Bram Moolenaar87b5ca52006-03-04 21:55:31 +0000109 |zg|. Without count the first name is used, with a
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000110 count of two the second entry, etc.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000111
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000112:spe[llgood]! {word} Add {word} as a good word to the internal word list,
Bram Moolenaar87b5ca52006-03-04 21:55:31 +0000113 like with |zG|.
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000114
Bram Moolenaar520470a2005-06-16 21:59:56 +0000115 *:spellw* *:spellwrong*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000116:[count]spellw[rong] {word}
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000117 Add {word} as a wrong (bad) word to 'spellfile', as
Bram Moolenaar87b5ca52006-03-04 21:55:31 +0000118 with |zw|. Without count the first name is used, with
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000119 a count of two the second entry, etc.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000120
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000121:spellw[rong]! {word} Add {word} as a wrong (bad) word to the internal word
Bram Moolenaar87b5ca52006-03-04 21:55:31 +0000122 list, like with |zW|.
123
Bram Moolenaara3891682019-08-16 22:42:13 +0200124 *:spellra* *:spellrare*
Bram Moolenaar10e8ff92023-06-10 21:40:39 +0100125:[count]spellra[re] {word}
Bram Moolenaar08cc3742019-08-11 22:51:14 +0200126 Add {word} as a rare word to 'spellfile', similar to
127 |zw|. Without count the first name is used, with
128 a count of two the second entry, etc.
129
130 There are no normal mode commands to mark words as
131 rare as this is a fairly uncommon command and all
132 intuitive commands for this are already taken. If you
133 want you can add mappings with e.g.: >
Bram Moolenaarc51cf032022-02-26 12:25:45 +0000134 nnoremap z? :exe ':spellrare ' .. expand('<cWORD>')<CR>
135 nnoremap z/ :exe ':spellrare! ' .. expand('<cWORD>')<CR>
Bram Moolenaar08cc3742019-08-11 22:51:14 +0200136< |:spellundo|, |zuw|, or |zuW| can be used to undo this.
137
Bram Moolenaar10e8ff92023-06-10 21:40:39 +0100138:spellra[re]! {word} Add {word} as a rare word to the internal word
Bram Moolenaar08cc3742019-08-11 22:51:14 +0200139 list, similar to |zW|.
140
Bram Moolenaar87b5ca52006-03-04 21:55:31 +0000141:[count]spellu[ndo] {word} *:spellu* *:spellundo*
142 Like |zuw|. [count] used as with |:spellgood|.
143
144:spellu[ndo]! {word} Like |zuW|. [count] used as with |:spellgood|.
145
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000146
Bram Moolenaarf461c8e2005-06-25 23:04:51 +0000147After adding a word to 'spellfile' with the above commands its associated
Bram Moolenaard042c562005-06-30 22:04:15 +0000148".spl" file will automatically be updated and reloaded. If you change
149'spellfile' manually you need to use the |:mkspell| command. This sequence of
150commands mostly works well: >
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000151 :edit <file in 'spellfile'>
Bram Moolenaarf461c8e2005-06-25 23:04:51 +0000152< (make changes to the spell file) >
153 :mkspell! %
154
155More details about the 'spellfile' format below |spell-wordlist-format|.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000156
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000157 *internal-wordlist*
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000158The internal word list is used for all buffers where 'spell' is set. It is
159not stored, it is lost when you exit Vim. It is also cleared when 'encoding'
160is set.
161
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000162
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000163Finding suggestions for bad words:
Bram Moolenaarcc016f52005-12-10 20:23:46 +0000164 *z=*
165z= For the word under/after the cursor suggest correctly
Bram Moolenaard042c562005-06-30 22:04:15 +0000166 spelled words. This also works to find alternatives
167 for a word that is not highlighted as a bad word,
168 e.g., when the word after it is bad.
Bram Moolenaar7df351e2006-01-23 22:30:28 +0000169 In Visual mode the highlighted text is taken as the
170 word to be replaced.
171 The results are sorted on similarity to the word being
172 replaced.
Bram Moolenaar90915b52005-08-21 22:17:52 +0000173 This may take a long time. Hit CTRL-C when you get
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000174 bored.
Bram Moolenaar90915b52005-08-21 22:17:52 +0000175
176 If the command is used without a count the
177 alternatives are listed and you can enter the number
178 of your choice or press <Enter> if you don't want to
179 replace. You can also use the mouse to click on your
180 choice (only works if the mouse can be used in Normal
181 mode and when there are no line wraps). Click on the
182 first line (the header) to cancel.
183
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000184 The suggestions listed normally replace a highlighted
185 bad word. Sometimes they include other text, in that
186 case the replaced text is also listed after a "<".
187
Bram Moolenaar90915b52005-08-21 22:17:52 +0000188 If a count is used that suggestion is used, without
Bram Moolenaarcc016f52005-12-10 20:23:46 +0000189 prompting. For example, "1z=" always takes the first
Bram Moolenaar90915b52005-08-21 22:17:52 +0000190 suggestion.
191
192 If 'verbose' is non-zero a score will be displayed
193 with the suggestions to indicate the likeliness to the
194 badly spelled word (the higher the score the more
195 different).
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000196 When a word was replaced the redo command "." will
197 repeat the word replacement. This works like "ciw",
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000198 the good word and <Esc>. This does NOT work for Thai
199 and other languages without spaces between words.
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000200
Bram Moolenaar24bbcfe2005-06-28 23:32:02 +0000201 *:spellr* *:spellrepall* *E752* *E753*
Bram Moolenaarcc016f52005-12-10 20:23:46 +0000202:spellr[epall] Repeat the replacement done by |z=| for all matches
Bram Moolenaar24bbcfe2005-06-28 23:32:02 +0000203 with the replaced word in the current window.
204
Bram Moolenaar488c6512005-08-11 20:09:58 +0000205In Insert mode, when the cursor is after a badly spelled word, you can use
206CTRL-X s to find suggestions. This works like Insert mode completion. Use
207CTRL-N to use the next suggestion, CTRL-P to go back. |i_CTRL-X_s|
208
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000209The 'spellsuggest' option influences how the list of suggestions is generated
210and sorted. See |'spellsuggest'|.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000211
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000212The 'spellcapcheck' option is used to check the first word of a sentence
213starts with a capital. This doesn't work for the first word in the file.
214When there is a line break right after a sentence the highlighting of the next
Bram Moolenaar90cfdbe2005-08-12 19:59:19 +0000215line may be postponed. Use |CTRL-L| when needed. Also see |set-spc-auto| for
216how it can be set automatically when 'spelllang' is set.
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000217
Bram Moolenaar362b44b2020-06-10 21:47:00 +0200218The 'spelloptions' option has a few more flags that influence the way spell
Bram Moolenaar71badf92023-04-22 22:40:14 +0100219checking works. For example, "camel" splits CamelCased words so that each
220part of the word is spell-checked separately.
Bram Moolenaar362b44b2020-06-10 21:47:00 +0200221
Bram Moolenaar4770d092006-01-12 23:22:24 +0000222Vim counts the number of times a good word is encountered. This is used to
223sort the suggestions: words that have been seen before get a small bonus,
224words that have been seen often get a bigger bonus. The COMMON item in the
225affix file can be used to define common words, so that this mechanism also
226works in a new or short file |spell-COMMON|.
227
Bram Moolenaard042c562005-06-30 22:04:15 +0000228==============================================================================
2292. Remarks on spell checking *spell-remarks*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000230
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000231PERFORMANCE
232
Bram Moolenaard042c562005-06-30 22:04:15 +0000233Vim does on-the-fly spell checking. To make this work fast the word list is
234loaded in memory. Thus this uses a lot of memory (1 Mbyte or more). There
235might also be a noticeable delay when the word list is loaded, which happens
236when 'spell' is set and when 'spelllang' is set while 'spell' was already set.
237To minimize the delay each word list is only loaded once, it is not deleted
238when 'spelllang' is made empty or 'spell' is reset. When 'encoding' is set
239all the word lists are reloaded, thus you may notice a delay then too.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000240
241
Bram Moolenaar217ad922005-03-20 22:37:15 +0000242REGIONS
243
244A word may be spelled differently in various regions. For example, English
245comes in (at least) these variants:
246
247 en all regions
Bram Moolenaar5c5474b2005-04-19 21:40:26 +0000248 en_au Australia
Bram Moolenaar217ad922005-03-20 22:37:15 +0000249 en_ca Canada
Bram Moolenaar5c5474b2005-04-19 21:40:26 +0000250 en_gb Great Britain
251 en_nz New Zealand
252 en_us USA
Bram Moolenaar217ad922005-03-20 22:37:15 +0000253
254Words that are not used in one region but are used in another region are
Bram Moolenaar520470a2005-06-16 21:59:56 +0000255highlighted with SpellLocal |hl-SpellLocal|.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000256
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000257Always use lowercase letters for the language and region names.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000258
Bram Moolenaar3638c682005-06-08 22:05:14 +0000259When adding a word with |zg| or another command it's always added for all
260regions. You can change that by manually editing the 'spellfile'. See
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000261|spell-wordlist-format|. Note that the regions as specified in the files in
Bram Moolenaar16d8f872005-11-26 23:46:11 +0000262'spellfile' are only used when all entries in 'spelllang' specify the same
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000263region (not counting files specified by their .spl name).
Bram Moolenaar3638c682005-06-08 22:05:14 +0000264
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000265 *spell-german*
Bram Moolenaarae5bce12005-08-15 21:41:48 +0000266Specific exception: For German these special regions are used:
267 de all German words accepted
268 de_de old and new spelling
269 de_19 old spelling
270 de_20 new spelling
271 de_at Austria
272 de_ch Switzerland
273
Bram Moolenaar92d640f2005-09-05 22:11:52 +0000274 *spell-russian*
275Specific exception: For Russian these special regions are used:
276 ru all Russian words accepted
277 ru_ru "IE" letter spelling
278 ru_yo "YO" letter spelling
279
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000280 *spell-yiddish*
281Yiddish requires using "utf-8" encoding, because of the special characters
282used. If you are using latin1 Vim will use transliterated (romanized) Yiddish
283instead. If you want to use transliterated Yiddish with utf-8 use "yi-tr".
284In a table:
285 'encoding' 'spelllang'
286 utf-8 yi Yiddish
287 latin1 yi transliterated Yiddish
288 utf-8 yi-tr transliterated Yiddish
289
Bram Moolenaarcc63c642013-11-12 04:44:01 +0100290 *spell-cjk*
291Chinese, Japanese and other East Asian characters are normally marked as
292errors, because spell checking of these characters is not supported. If
293'spelllang' includes "cjk", these characters are not marked as errors. This
294is useful when editing text with spell checking while some Asian words are
295present.
296
Bram Moolenaar217ad922005-03-20 22:37:15 +0000297
Bram Moolenaar3b506942005-06-23 22:36:45 +0000298SPELL FILES *spell-load*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000299
300Vim searches for spell files in the "spell" subdirectory of the directories in
Bram Moolenaar3638c682005-06-08 22:05:14 +0000301'runtimepath'. The name is: LL.EEE.spl, where:
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000302 LL the language name
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000303 EEE the value of 'encoding'
Bram Moolenaar217ad922005-03-20 22:37:15 +0000304
Bram Moolenaar3b506942005-06-23 22:36:45 +0000305The value for "LL" comes from 'spelllang', but excludes the region name.
306Examples:
307 'spelllang' LL ~
308 en_us en
309 en-rare en-rare
310 medical_ca medical
311
Bram Moolenaar3638c682005-06-08 22:05:14 +0000312Only the first file is loaded, the one that is first in 'runtimepath'. If
313this succeeds then additionally files with the name LL.EEE.add.spl are loaded.
314All the ones that are found are used.
315
Bram Moolenaar1ef15e32006-02-01 21:56:25 +0000316If no spell file is found the |SpellFileMissing| autocommand event is
317triggered. This may trigger the |spellfile.vim| plugin to offer you
318downloading the spell file.
319
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000320Additionally, the files related to the names in 'spellfile' are loaded. These
321are the files that |zg| and |zw| add good and wrong words to.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000322
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000323Exceptions:
324- Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign doesn't
325 matter for spelling.
326- When no spell file for 'encoding' is found "ascii" is tried. This only
327 works for languages where nearly all words are ASCII, such as English. It
328 helps when 'encoding' is not "latin1", such as iso-8859-2, and English text
Bram Moolenaar3638c682005-06-08 22:05:14 +0000329 is being edited. For the ".add" files the same name as the found main
330 spell file is used.
331
332For example, with these values:
Bram Moolenaar8024f932020-01-14 19:29:13 +0100333 'runtimepath' is "~/.vim,/usr/share/vim82,~/.vim/after"
Bram Moolenaar3638c682005-06-08 22:05:14 +0000334 'encoding' is "iso-8859-2"
335 'spelllang' is "pl"
336
337Vim will look for:
3381. ~/.vim/spell/pl.iso-8859-2.spl
Bram Moolenaar8024f932020-01-14 19:29:13 +01003392. /usr/share/vim82/spell/pl.iso-8859-2.spl
Bram Moolenaar3638c682005-06-08 22:05:14 +00003403. ~/.vim/spell/pl.iso-8859-2.add.spl
Bram Moolenaar8024f932020-01-14 19:29:13 +01003414. /usr/share/vim82/spell/pl.iso-8859-2.add.spl
Bram Moolenaar3638c682005-06-08 22:05:14 +00003425. ~/.vim/after/spell/pl.iso-8859-2.add.spl
343
344This assumes 1. is not found and 2. is found.
345
346If 'encoding' is "latin1" Vim will look for:
3471. ~/.vim/spell/pl.latin1.spl
Bram Moolenaar8024f932020-01-14 19:29:13 +01003482. /usr/share/vim82/spell/pl.latin1.spl
Bram Moolenaar3638c682005-06-08 22:05:14 +00003493. ~/.vim/after/spell/pl.latin1.spl
3504. ~/.vim/spell/pl.ascii.spl
Bram Moolenaar8024f932020-01-14 19:29:13 +01003515. /usr/share/vim82/spell/pl.ascii.spl
Bram Moolenaar3638c682005-06-08 22:05:14 +00003526. ~/.vim/after/spell/pl.ascii.spl
353
354This assumes none of them are found (Polish doesn't make sense when leaving
355out the non-ASCII characters).
Bram Moolenaar217ad922005-03-20 22:37:15 +0000356
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000357Spelling for EBCDIC is currently not supported.
358
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000359A spell file might not be available in the current 'encoding'. See
360|spell-mkspell| about how to create a spell file. Converting a spell file
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000361with "iconv" will NOT work!
Bram Moolenaar217ad922005-03-20 22:37:15 +0000362
Bram Moolenaar81af9252010-12-10 20:35:50 +0100363Note: on VMS ".{enc}.spl" is changed to "_{enc}.spl" to avoid trouble with
364filenames.
365
Bram Moolenaara40ceaf2006-01-13 22:35:40 +0000366 *spell-sug-file* *E781*
Bram Moolenaar4770d092006-01-12 23:22:24 +0000367If there is a file with exactly the same name as the ".spl" file but ending in
368".sug", that file will be used for giving better suggestions. It isn't loaded
369before suggestions are made to reduce memory use.
370
Bram Moolenaara40ceaf2006-01-13 22:35:40 +0000371 *E758* *E759* *E778* *E779* *E780* *E782*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000372When loading a spell file Vim checks that it is properly formatted. If you
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000373get an error the file may be truncated, modified or intended for another Vim
374version.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000375
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000376
Bram Moolenaar87b5ca52006-03-04 21:55:31 +0000377SPELLFILE CLEANUP *spellfile-cleanup*
378
379The |zw| command turns existing entries in 'spellfile' into comment lines.
380This avoids having to write a new file every time, but results in the file
381only getting longer, never shorter. To clean up the comment lines in all
382".add" spell files do this: >
383 :runtime spell/cleanadd.vim
384
385This deletes all comment lines, except the ones that start with "##". Use
386"##" lines to add comments that you want to keep.
387
388You can invoke this script as often as you like. A variable is provided to
389skip updating files that have been changed recently. Set it to the number of
390seconds that has passed since a file was changed before it will be cleaned.
391For example, to clean only files that were not changed in the last hour: >
392 let g:spell_clean_limit = 60 * 60
393The default is one second.
394
395
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000396WORDS
397
398Vim uses a fixed method to recognize a word. This is independent of
399'iskeyword', so that it also works in help files and for languages that
400include characters like '-' in 'iskeyword'. The word characters do depend on
401'encoding'.
402
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000403The table with word characters is stored in the main .spl file. Therefore it
404matters what the current locale is when generating it! A .add.spl file does
Bram Moolenaarf461c8e2005-06-25 23:04:51 +0000405not contain a word table though.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000406
Bram Moolenaarf9393ef2006-04-24 19:47:27 +0000407For a word that starts with a digit the digit is ignored, unless the word as a
408whole is recognized. Thus if "3D" is a word and "D" is not then "3D" is
409recognized as a word, but if "3D" is not a word then only the "D" is marked as
410bad. Hex numbers in the form 0x12ab and 0X12AB are recognized.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000411
412
Bram Moolenaar30abd282005-06-22 22:35:10 +0000413WORD COMBINATIONS
414
415It is possible to spell-check words that include a space. This is used to
416recognize words that are invalid when used by themselves, e.g. for "et al.".
417It can also be used to recognize "the the" and highlight it.
418
419The number of spaces is irrelevant. In most cases a line break may also
420appear. However, this makes it difficult to find out where to start checking
421for spelling mistakes. When you make a change to one line and only that line
422is redrawn Vim won't look in the previous line, thus when "et" is at the end
423of the previous line "al." will be flagged as an error. And when you type
424"the<CR>the" the highlighting doesn't appear until the first line is redrawn.
425Use |CTRL-L| to redraw right away. "[s" will also stop at a word combination
426with a line break.
427
428When encountering a line break Vim skips characters such as '*', '>' and '"',
429so that comments in C, shell and Vim code can be spell checked.
430
431
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +0000432SYNTAX HIGHLIGHTING *spell-syntax*
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000433
434Files that use syntax highlighting can specify where spell checking should be
435done:
436
Bram Moolenaar3638c682005-06-08 22:05:14 +00004371. everywhere default
4382. in specific items use "contains=@Spell"
4393. everywhere but specific items use "contains=@NoSpell"
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000440
Bram Moolenaar3638c682005-06-08 22:05:14 +0000441For the second method adding the @NoSpell cluster will disable spell checking
442again. This can be used, for example, to add @Spell to the comments of a
443program, and add @NoSpell for items that shouldn't be checked.
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000444Also see |:syn-spell| for text that is not in a syntax item.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000445
Bram Moolenaar30abd282005-06-22 22:35:10 +0000446
447VIM SCRIPTS
448
449If you want to write a Vim script that does something with spelling, you may
450find these functions useful:
451
452 spellbadword() find badly spelled word at the cursor
453 spellsuggest() get list of spelling suggestions
Bram Moolenaard042c562005-06-30 22:04:15 +0000454 soundfold() get the sound-a-like version of a word
Bram Moolenaar30abd282005-06-22 22:35:10 +0000455
Bram Moolenaar90cfdbe2005-08-12 19:59:19 +0000456
457SETTING 'spellcapcheck' AUTOMATICALLY *set-spc-auto*
458
459After the 'spelllang' option has been set successfully, Vim will source the
460files "spell/LANG.vim" in 'runtimepath'. "LANG" is the value of 'spelllang'
461up to the first comma, dot or underscore. This can be used to set options
462specifically for the language, especially 'spellcapcheck'.
463
464The distribution includes a few of these files. Use this command to see what
465they do: >
466 :next $VIMRUNTIME/spell/*.vim
467
468Note that the default scripts don't set 'spellcapcheck' if it was changed from
469the default value. This assumes the user prefers another value then.
470
Bram Moolenaarae5bce12005-08-15 21:41:48 +0000471
472DOUBLE SCORING *spell-double-scoring*
473
474The 'spellsuggest' option can be used to select "double" scoring. This
475mechanism is based on the principle that there are two kinds of spelling
476mistakes:
477
4781. You know how to spell the word, but mistype something. This results in a
479 small editing distance (character swapped/omitted/inserted) and possibly a
480 word that sounds completely different.
481
4822. You don't know how to spell the word and type something that sounds right.
483 The edit distance can be big but the word is similar after sound-folding.
484
485Since scores for these two mistakes will be very different we use a list
486for each and mix them.
487
488The sound-folding is slow and people that know the language won't make the
489second kind of mistakes. Therefore 'spellsuggest' can be set to select the
490preferred method for scoring the suggestions.
491
Bram Moolenaar217ad922005-03-20 22:37:15 +0000492==============================================================================
Bram Moolenaard042c562005-06-30 22:04:15 +00004933. Generating a spell file *spell-mkspell*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000494
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000495Vim uses a binary file format for spelling. This greatly speeds up loading
496the word list and keeps it small.
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000497 *.aff* *.dic* *Myspell*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000498You can create a Vim spell file from the .aff and .dic files that Myspell
Bram Moolenaar6aa8cea2017-06-05 14:44:35 +0200499uses. Myspell is used by OpenOffice.org and Mozilla. The OpenOffice .oxt
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200500files are zip files which contain the .aff and .dic files. You should be able
501to find them here:
502 http://extensions.services.openoffice.org/dictionary
503The older, OpenOffice 2 files may be used if this doesn't work:
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000504 http://wiki.services.openoffice.org/wiki/Dictionaries
Bram Moolenaar30abd282005-06-22 22:35:10 +0000505You can also use a plain word list. The results are the same, the choice
Bram Moolenaard042c562005-06-30 22:04:15 +0000506depends on what word lists you can find.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000507
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000508If you install Aap (from www.a-a-p.org) you can use the recipes in the
509runtime/spell/??/ directories. Aap will take care of downloading the files,
510apply patches needed for Vim and build the .spl file.
511
Bram Moolenaare13305e2005-06-19 22:54:15 +0000512Make sure your current locale is set properly, otherwise Vim doesn't know what
513characters are upper/lower case letters. If the locale isn't available (e.g.,
514when using an MS-Windows codepage on Unix) add tables to the .aff file
Bram Moolenaar3b506942005-06-23 22:36:45 +0000515|spell-affix-chars|. If the .aff file doesn't define a table then the word
516table of the currently active spelling is used. If spelling is not active
517then Vim will try to guess.
Bram Moolenaare13305e2005-06-19 22:54:15 +0000518
Bram Moolenaar3b506942005-06-23 22:36:45 +0000519 *:mksp* *:mkspell*
520:mksp[ell][!] [-ascii] {outname} {inname} ...
Bram Moolenaar16d8f872005-11-26 23:46:11 +0000521 Generate a Vim spell file from word lists. Example: >
Bram Moolenaard042c562005-06-30 22:04:15 +0000522 :mkspell /tmp/nl nl_NL.words
Bram Moolenaar3b506942005-06-23 22:36:45 +0000523< *E751*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000524 When {outname} ends in ".spl" it is used as the output
525 file name. Otherwise it should be a language name,
Bram Moolenaar3b506942005-06-23 22:36:45 +0000526 such as "en", without the region name. The file
527 written will be "{outname}.{encoding}.spl", where
528 {encoding} is the value of the 'encoding' option.
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000529
Bram Moolenaard042c562005-06-30 22:04:15 +0000530 When the output file already exists [!] must be used
Bram Moolenaar520470a2005-06-16 21:59:56 +0000531 to overwrite it.
532
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000533 When the [-ascii] argument is present, words with
534 non-ascii characters are skipped. The resulting file
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000535 ends in "ascii.spl".
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000536
537 The input can be the Myspell format files {inname}.aff
538 and {inname}.dic. If {inname}.aff does not exist then
539 {inname} is used as the file name of a plain word
540 list.
541
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000542 Multiple {inname} arguments can be given to combine
543 regions into one Vim spell file. Example: >
544 :mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU
545< This combines the English word lists for US, CA and AU
546 into one en.spl file.
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000547 Up to eight regions can be combined. *E754* *E755*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000548 The REP and SAL items of the first .aff file where
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000549 they appear are used. |spell-REP| |spell-SAL|
Bram Moolenaard58e9292011-02-09 17:07:58 +0100550 *E845*
Bram Moolenaar30abd282005-06-22 22:35:10 +0000551 This command uses a lot of memory, required to find
Bram Moolenaar8aff23a2005-08-19 20:40:30 +0000552 the optimal word tree (Polish, Italian and Hungarian
553 require several hundred Mbyte). The final result will
554 be much smaller, because compression is used. To
555 avoid running out of memory compression will be done
556 now and then. This can be tuned with the 'mkspellmem'
557 option.
Bram Moolenaar30abd282005-06-22 22:35:10 +0000558
Bram Moolenaard042c562005-06-30 22:04:15 +0000559 After the spell file was written and it was being used
560 in a buffer it will be reloaded automatically.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000561
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000562:mksp[ell] [-ascii] {name}.{enc}.add
563 Like ":mkspell" above, using {name}.{enc}.add as the
Bram Moolenaard042c562005-06-30 22:04:15 +0000564 input file and producing an output file in the same
565 directory that has ".spl" appended.
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000566
567:mksp[ell] [-ascii] {name}
568 Like ":mkspell" above, using {name} as the input file
Bram Moolenaard042c562005-06-30 22:04:15 +0000569 and producing an output file in the same directory
570 that has ".{enc}.spl" appended.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000571
Bram Moolenaarae5bce12005-08-15 21:41:48 +0000572Vim will report the number of duplicate words. This might be a mistake in the
573list of words. But sometimes it is used to have different prefixes and
574suffixes for the same basic word to avoid them combining (e.g. Czech uses
Bram Moolenaar8aff23a2005-08-19 20:40:30 +0000575this). If you want Vim to report all duplicate words set the 'verbose'
576option.
Bram Moolenaarae5bce12005-08-15 21:41:48 +0000577
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000578Since you might want to change a Myspell word list for use with Vim the
579following procedure is recommended:
Bram Moolenaar217ad922005-03-20 22:37:15 +0000580
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +00005811. Obtain the xx_YY.aff and xx_YY.dic files from Myspell.
5822. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic.
5833. Change the xx_YY.aff and xx_YY.dic files to remove bad words, add missing
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000584 words, define word characters with FOL/LOW/UPP, etc. The distributed
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000585 "*.diff" files can be used.
Bram Moolenaard042c562005-06-30 22:04:15 +00005864. Start Vim with the right locale and use |:mkspell| to generate the Vim
587 spell file.
5885. Try out the spell file with ":set spell spelllang=xx" if you wrote it in
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000589 a spell directory in 'runtimepath', or ":set spelllang=xx.enc.spl" if you
Bram Moolenaard042c562005-06-30 22:04:15 +0000590 wrote it somewhere else.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000591
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000592When the Myspell files are updated you can merge the differences:
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00005931. Obtain the new Myspell files as xx_YY.new.aff and xx_UU.new.dic.
5942. Use Vimdiff to see what changed: >
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000595 vimdiff xx_YY.orig.dic xx_YY.new.dic
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00005963. Take over the changes you like in xx_YY.dic.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000597 You may also need to change xx_YY.aff.
Bram Moolenaard09091d2019-01-17 16:07:22 +01005984. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.orig.aff.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000599
Bram Moolenaar3b506942005-06-23 22:36:45 +0000600
Bram Moolenaar8aff23a2005-08-19 20:40:30 +0000601SPELL FILE VERSIONS *E770* *E771* *E772*
602
603Spell checking is a relatively new feature in Vim, thus it's possible that the
604.spl file format will be changed to support more languages. Vim will check
605the validity of the spell file and report anything wrong.
606
607 E771: Old spell file, needs to be updated ~
608This spell file is older than your Vim. You need to update the .spl file.
609
610 E772: Spell file is for newer version of Vim ~
611This means the spell file was made for a later version of Vim. You need to
612update Vim.
613
614 E770: Unsupported section in spell file ~
615This means the spell file was made for a later version of Vim and contains a
616section that is required for the spell file to work. In this case it's
617probably a good idea to upgrade your Vim.
618
619
Bram Moolenaar3b506942005-06-23 22:36:45 +0000620SPELL FILE DUMP
621
622If for some reason you want to check what words are supported by the currently
623used spelling files, use this command:
624
625 *:spelldump* *:spelld*
626:spelld[ump] Open a new window and fill it with all currently valid
Bram Moolenaarac6e65f2005-08-29 22:25:38 +0000627 words. Compound words are not included.
Bram Moolenaard042c562005-06-30 22:04:15 +0000628 Note: For some languages the result may be enormous,
629 causing Vim to run out of memory.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000630
Bram Moolenaar4770d092006-01-12 23:22:24 +0000631:spelld[ump]! Like ":spelldump" and include the word count. This is
632 the number of times the word was found while
633 updating the screen. Words that are in COMMON items
634 get a starting count of 10.
635
Bram Moolenaar3b506942005-06-23 22:36:45 +0000636The format of the word list is used |spell-wordlist-format|. You should be
637able to read it with ":mkspell" to generate one .spl file that includes all
638the words.
639
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000640When all entries to 'spelllang' use the same regions or no regions at all then
641the region information is included in the dumped words. Otherwise only words
642for the current region are included and no "/regions" line is generated.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000643
Bram Moolenaard042c562005-06-30 22:04:15 +0000644Comment lines with the name of the .spl file are used as a header above the
645words that were generated from that .spl file.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000646
Bram Moolenaar1ef15e32006-02-01 21:56:25 +0000647
648SPELL FILE MISSING *spell-SpellFileMissing* *spellfile.vim*
649
650If the spell file for the language you are using is not available, you will
651get an error message. But if the "spellfile.vim" plugin is active it will
652offer you to download the spell file. Just follow the instructions, it will
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000653ask you where to write the file (there must be a writable directory in
654'runtimepath' for this).
Bram Moolenaar1ef15e32006-02-01 21:56:25 +0000655
656The plugin has a default place where to look for spell files, on the Vim ftp
Bram Moolenaar7ff78462020-07-10 22:00:53 +0200657server. The protocol used is SSL (https://) for security. If you want to use
658another location or another protocol, set the g:spellfile_URL variable to the
659directory that holds the spell files. You can use http:// or ftp://, but you
660are taking a security risk then. The |netrw| plugin is used for getting the
661file, look there for the specific syntax of the URL. Example: >
662 let g:spellfile_URL = 'https://ftp.nluug.nl/vim/runtime/spell'
Bram Moolenaar1ef15e32006-02-01 21:56:25 +0000663You may need to escape special characters.
664
665The plugin will only ask about downloading a language once. If you want to
666try again anyway restart Vim, or set g:spellfile_URL to another value (e.g.,
667prepend a space).
668
669To avoid using the "spellfile.vim" plugin do this in your vimrc file: >
670
671 let loaded_spellfile_plugin = 1
672
673Instead of using the plugin you can define a |SpellFileMissing| autocommand to
674handle the missing file yourself. You can use it like this: >
675
676 :au SpellFileMissing * call Download_spell_file(expand('<amatch>'))
677
678Thus the <amatch> item contains the name of the language. Another important
679value is 'encoding', since every encoding has its own spell file. With two
680exceptions:
681- For ISO-8859-15 (latin9) the name "latin1" is used (the encodings only
682 differ in characters not used in dictionary words).
683- The name "ascii" may also be used for some languages where the words use
684 only ASCII letters for most of the words.
685
686The default "spellfile.vim" plugin uses this autocommand, if you define your
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000687autocommand afterwards you may want to use ":au! SpellFileMissing" to overrule
Bram Moolenaar1ef15e32006-02-01 21:56:25 +0000688it. If you define your autocommand before the plugin is loaded it will notice
689this and not do anything.
Bram Moolenaar34e0bfa2007-05-10 18:44:18 +0000690 *E797*
691Note that the SpellFileMissing autocommand must not change or destroy the
692buffer the user was editing.
Bram Moolenaar1ef15e32006-02-01 21:56:25 +0000693
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000694==============================================================================
Bram Moolenaard042c562005-06-30 22:04:15 +00006954. Spell file format *spell-file-format*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000696
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000697This is the format of the files that are used by the person who creates and
698maintains a word list.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000699
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000700Note that we avoid the word "dictionary" here. That is because the goal of
701spell checking differs from writing a dictionary (as in the book). For
Bram Moolenaar16d8f872005-11-26 23:46:11 +0000702spelling we need a list of words that are OK, thus should not be highlighted.
703Person and company names will not appear in a dictionary, but do appear in a
704word list. And some old words are rarely used while they are common
705misspellings. These do appear in a dictionary but not in a word list.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000706
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000707There are two formats: A straight list of words and a list using affix
Bram Moolenaard042c562005-06-30 22:04:15 +0000708compression. The files with affix compression are used by Myspell (Mozilla
709and OpenOffice.org). This requires two files, one with .aff and one with .dic
710extension.
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000711
712
Bram Moolenaard042c562005-06-30 22:04:15 +0000713FORMAT OF STRAIGHT WORD LIST *spell-wordlist-format*
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000714
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000715The words must appear one per line. That is all that is required.
Bram Moolenaard042c562005-06-30 22:04:15 +0000716
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000717Additionally the following items are recognized:
Bram Moolenaard042c562005-06-30 22:04:15 +0000718
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000719- Empty and blank lines are ignored.
Bram Moolenaard042c562005-06-30 22:04:15 +0000720
Bram Moolenaar4770d092006-01-12 23:22:24 +0000721 # comment ~
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000722- Lines starting with a # are ignored (comment lines).
Bram Moolenaard042c562005-06-30 22:04:15 +0000723
Bram Moolenaar4770d092006-01-12 23:22:24 +0000724 /encoding=utf-8 ~
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000725- A line starting with "/encoding=", before any word, specifies the encoding
726 of the file. After the second '=' comes an encoding name. This tells Vim
Bram Moolenaard042c562005-06-30 22:04:15 +0000727 to setup conversion from the specified encoding to 'encoding'. Thus you can
728 use one word list for several target encodings.
729
Bram Moolenaar4770d092006-01-12 23:22:24 +0000730 /regions=usca ~
Bram Moolenaar3638c682005-06-08 22:05:14 +0000731- A line starting with "/regions=" specifies the region names that are
732 supported. Each region name must be two ASCII letters. The first one is
733 region 1. Thus "/regions=usca" has region 1 "us" and region 2 "ca".
Bram Moolenaard042c562005-06-30 22:04:15 +0000734 In an addition word list the region names should be equal to the main word
735 list!
736
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000737- Other lines starting with '/' are reserved for future use. The ones that
Bram Moolenaar4770d092006-01-12 23:22:24 +0000738 are not recognized are ignored. You do get a warning message, so that you
739 know something won't work.
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000740
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000741- A "/" may follow the word with the following items:
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000742 = Case must match exactly.
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000743 ? Rare word.
744 ! Bad (wrong) word.
Bram Moolenaar01164a62017-11-02 22:58:42 +0100745 1 to 9 A region in which the word is valid. If no regions are
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000746 specified the word is valid in all regions.
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000747
Bram Moolenaar3638c682005-06-08 22:05:14 +0000748Example:
749
750 # This is an example word list comment
751 /encoding=latin1 encoding of the file
752 /regions=uscagb regions "us", "ca" and "gb"
753 example word for all regions
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000754 blah/12 word for regions "us" and "ca"
755 vim/! bad word
756 Campbell/?3 rare word in region 3 "gb"
757 's mornings/= keep-case word
Bram Moolenaar3638c682005-06-08 22:05:14 +0000758
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000759Note that when "/=" is used the same word with all upper-case letters is not
760accepted. This is different from a word with mixed case that is automatically
761marked as keep-case, those words may appear in all upper-case letters.
762
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000763
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000764FORMAT WITH .AFF AND .DIC FILES *aff-dic-format*
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000765
Bram Moolenaar4770d092006-01-12 23:22:24 +0000766There are two files: the basic word list and an affix file. The affix file
767specifies settings for the language and can contain affixes. The affixes are
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000768used to modify the basic words to get the full word list. This significantly
769reduces the number of words, especially for a language like Polish. This is
770called affix compression.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000771
Bram Moolenaar4770d092006-01-12 23:22:24 +0000772The basic word list and the affix file are combined with the ":mkspell"
773command and results in a binary spell file. All the preprocessing has been
774done, thus this file loads fast. The binary spell file format is described in
775the source code (src/spell.c). But only developers need to know about it.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000776
777The preprocessing also allows us to take the Myspell language files and modify
778them before the Vim word list is made. The tools for this can be found in the
779"src/spell" directory.
780
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000781The format for the affix and word list files is based on what Myspell uses
782(the spell checker of Mozilla and OpenOffice.org). A description can be found
783here:
784 http://lingucomponent.openoffice.org/affix.readme ~
785Note that affixes are case sensitive, this isn't obvious from the description.
786
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000787Vim supports quite a few extras. They are described below |spell-affix-vim|.
788Attempts have been made to keep this compatible with other spell checkers, so
Bram Moolenaar4770d092006-01-12 23:22:24 +0000789that the same files can often be used. One other project that offers more
790than Myspell is Hunspell ( http://hunspell.sf.net ).
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000791
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000792
Bram Moolenaar3638c682005-06-08 22:05:14 +0000793WORD LIST FORMAT *spell-dic-format*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000794
Bram Moolenaar4770d092006-01-12 23:22:24 +0000795A short example, with line numbers:
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000796
Bram Moolenaar4770d092006-01-12 23:22:24 +0000797 1 1234 ~
798 2 aan ~
799 3 Als ~
800 4 Etten-Leur ~
801 5 et al. ~
802 6 's-Gravenhage ~
803 7 's-Gravenhaags ~
804 8 # word that differs between regions ~
805 9 kado/1 ~
806 10 cadeau/2 ~
807 11 TCP,IP ~
808 12 /the S affix may add a 's' ~
809 13 bedel/S ~
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000810
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000811The first line contains the number of words. Vim ignores it, but you do get
812an error message if it's not there. *E760*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000813
Bram Moolenaar4770d092006-01-12 23:22:24 +0000814What follows is one word per line. White space at the end of the line is
815ignored, all other white space matters. The encoding is specified in the
816affix file |spell-SET|.
817
818Comment lines start with '#' or '/'. See the example lines 8 and 12. Note
819that putting a comment after a word is NOT allowed:
820
821 someword # comment that causes an error! ~
822
823After the word there is an optional slash and flags. Most of these flags are
824letters that indicate the affixes that can be used with this word. These are
825specified with SFX and PFX lines in the .aff file, see |spell-SFX| and
826|spell-PFX|. Vim allows using other flag types with the FLAG item in the
827affix file |spell-FLAG|.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000828
829When the word only has lower-case letters it will also match with the word
830starting with an upper-case letter.
831
832When the word includes an upper-case letter, this means the upper-case letter
833is required at this position. The same word with a lower-case letter at this
834position will not match. When some of the other letters are upper-case it will
835not match either.
836
Bram Moolenaar4770d092006-01-12 23:22:24 +0000837The word with all upper-case characters will always be OK,
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000838
839 word list matches does not match ~
840 als als Als ALS ALs AlS aLs aLS
841 Als Als ALS als ALs AlS aLs aLS
842 ALS ALS als Als ALs AlS aLs aLS
843 AlS AlS ALS als Als ALs aLs aLS
844
Bram Moolenaar1cbe5f72005-12-29 22:51:09 +0000845The KEEPCASE affix ID can be used to specifically match a word with identical
846case only, see below |spell-KEEPCASE|.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000847
Bram Moolenaar4770d092006-01-12 23:22:24 +0000848Note: in line 5 to 7 non-word characters are used. You can include any
849character in a word. When checking the text a word still only matches when it
850appears with a non-word character before and after it. For Myspell a word
851starting with a non-word character probably won't work.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000852
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000853In line 12 the word "TCP/IP" is defined. Since the slash has a special
854meaning the comma is used instead. This is defined with the SLASH item in the
Bram Moolenaar4770d092006-01-12 23:22:24 +0000855affix file, see |spell-SLASH|. Note that without this SLASH item the word
856will be "TCP,IP".
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000857
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000858
Bram Moolenaar4770d092006-01-12 23:22:24 +0000859AFFIX FILE FORMAT *spell-aff-format* *spell-affix-vim*
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000860
Bram Moolenaar4770d092006-01-12 23:22:24 +0000861 *spell-affix-comment*
862Comment lines in the .aff file start with a '#':
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000863
Bram Moolenaar4770d092006-01-12 23:22:24 +0000864 # comment line ~
865
Bram Moolenaar9f94b052008-11-30 20:12:46 +0000866Items with a fixed number of arguments can be followed by a comment. But only
867if none of the arguments can contain white space. The comment must start with
868a "#" character. Example:
869
870 KEEPCASE = # fix case for words with this flag ~
Bram Moolenaar4770d092006-01-12 23:22:24 +0000871
872
873ENCODING *spell-SET*
874
875The affix file can be in any encoding that is supported by "iconv". However,
876in some cases the current locale should also be set properly at the time
877|:mkspell| is invoked. Adding FOL/LOW/UPP lines removes this requirement
878|spell-FOL|.
879
880The encoding should be specified before anything where the encoding matters.
881The encoding applies both to the affix file and the dictionary file. It is
882done with a SET line:
883
884 SET utf-8 ~
885
886The encoding can be different from the value of the 'encoding' option at the
887time ":mkspell" is used. Vim will then convert everything to 'encoding' and
888generate a spell file for 'encoding'. If some of the used characters to not
889fit in 'encoding' you will get an error message.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000890 *spell-affix-mbyte*
Bram Moolenaar207f0092020-08-30 17:20:20 +0200891When using a multibyte encoding it's possible to use more different affix
Bram Moolenaar4770d092006-01-12 23:22:24 +0000892flags. But Myspell doesn't support that, thus you may not want to use it
893anyway. For compatibility use an 8-bit encoding.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000894
Bram Moolenaare13305e2005-06-19 22:54:15 +0000895
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000896INFORMATION
897
898These entries in the affix file can be used to add information to the spell
899file. There are no restrictions on the format, but they should be in the
900right encoding.
901
902 *spell-NAME* *spell-VERSION* *spell-HOME*
903 *spell-AUTHOR* *spell-EMAIL* *spell-COPYRIGHT*
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000904 NAME Name of the language
905 VERSION 1.0.1 with fixes
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000906 HOME http://www.myhome.eu
907 AUTHOR John Doe
908 EMAIL john AT Doe DOT net
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000909 COPYRIGHT LGPL
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000910
911These fields are put in the .spl file as-is. The |:spellinfo| command can be
912used to view the info.
913
914 *:spellinfo* *:spelli*
915:spelli[nfo] Display the information for the spell file(s) used for
916 the current buffer.
917
918
Bram Moolenaare13305e2005-06-19 22:54:15 +0000919CHARACTER TABLES
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000920 *spell-affix-chars*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000921When using an 8-bit encoding the affix file should define what characters are
Bram Moolenaar4770d092006-01-12 23:22:24 +0000922word characters. This is because the system where ":mkspell" is used may not
923support a locale with this encoding and isalpha() won't work. For example
924when using "cp1250" on Unix.
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000925 *E761* *E762* *spell-FOL*
926 *spell-LOW* *spell-UPP*
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000927Three lines in the affix file are needed. Simplistic example:
928
Bram Moolenaarab943432018-03-29 18:27:07 +0200929 FOL áëñ ~
930 LOW áëñ ~
931 UPP ÁËÑ ~
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000932
933All three lines must have exactly the same number of characters.
934
935The "FOL" line specifies the case-folded characters. These are used to
936compare words while ignoring case. For most encodings this is identical to
937the lower case line.
938
939The "LOW" line specifies the characters in lower-case. Mostly it's equal to
940the "FOL" line.
941
942The "UPP" line specifies the characters with upper-case. That is, a character
943is upper-case where it's different from the character at the same position in
944"FOL".
945
Bram Moolenaarab943432018-03-29 18:27:07 +0200946An exception is made for the German sharp s ß. The upper-case version is
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000947"SS". In the FOL/LOW/UPP lines it should be included, so that it's recognized
Bram Moolenaarab943432018-03-29 18:27:07 +0200948as a word character, but use the ß character in all three.
Bram Moolenaar6f16eb82005-08-23 21:02:42 +0000949
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000950ASCII characters should be omitted, Vim always handles these in the same way.
951When the encoding is UTF-8 no word characters need to be specified.
952
953 *E763*
Bram Moolenaar3b506942005-06-23 22:36:45 +0000954Vim allows you to use spell checking for several languages in the same file.
955You can list them in the 'spelllang' option. As a consequence all spell files
956for the same encoding must use the same word characters, otherwise they can't
Bram Moolenaar22dbc772013-06-28 18:44:48 +0200957be combined without errors.
958
959If you get an E763 warning that the word tables differ you need to update your
960".spl" spell files. If you downloaded the files, get the latest version of
Bram Moolenaar8bb1c3e2014-07-04 16:43:17 +0200961all spell files you use. If you are only using one, e.g., German, then also
962download the recent English spell files. Otherwise generate the .spl file
963again with |:mkspell|. If you still get errors check the FOL, LOW and UPP
964lines in the used .aff files.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000965
966The XX.ascii.spl spell file generated with the "-ascii" argument will not
967contain the table with characters, so that it can be combine with spell files
968for any encoding. The .add.spl files also do not contain the table.
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000969
Bram Moolenaare7566042005-06-17 22:00:15 +0000970
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000971MID-WORD CHARACTERS
972 *spell-midword*
973Some characters are only to be considered word characters if they are used in
974between two ordinary word characters. An example is the single quote: It is
975often used to put text in quotes, thus it can't be recognized as a word
976character, but when it appears in between word characters it must be part of
977the word. This is needed to detect a spelling error such as they'are. That
978should be they're, but since "they" and "are" are words themselves that would
979go unnoticed.
980
Bram Moolenaar4770d092006-01-12 23:22:24 +0000981These characters are defined with MIDWORD in the .aff file. Example:
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000982
983 MIDWORD '- ~
984
985
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +0000986FLAG TYPES *spell-FLAG*
987
988Flags are used to specify the affixes that can be used with a word and for
989other properties of the word. Normally single-character flags are used. This
990limits the number of possible flags, especially for 8-bit encodings. The FLAG
991item can be used if more affixes are to be used. Possible values:
992
993 FLAG long use two-character flags
994 FLAG num use numbers, from 1 up to 65000
Bram Moolenaar81f1ecb2005-08-25 21:27:31 +0000995 FLAG caplong use one-character flags without A-Z and two-character
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +0000996 flags that start with A-Z
997
998With "FLAG num" the numbers in a list of affixes need to be separated with a
999comma: "234,2143,1435". This method is inefficient, but useful if the file is
1000generated with a program.
1001
Bram Moolenaar81f1ecb2005-08-25 21:27:31 +00001002When using "caplong" the two-character flags all start with a capital: "Aa",
1003"B1", "BB", etc. This is useful to use one-character flags for the most
1004common items and two-character flags for uncommon items.
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00001005
1006Note: When using utf-8 only characters up to 65000 may be used for flags.
1007
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001008Note: even when using "num" or "long" the number of flags available to
1009compounding and prefixes is limited to about 250.
1010
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00001011
Bram Moolenaar76db9e02022-11-09 21:21:04 +00001012AFFIXES *spell-PFX* *spell-SFX*
1013
Bram Moolenaare13305e2005-06-19 22:54:15 +00001014The usual PFX (prefix) and SFX (suffix) lines are supported (see the Myspell
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +00001015documentation or the Aspell manual:
1016http://aspell.net/man-html/Affix-Compression.html).
Bram Moolenaare13305e2005-06-19 22:54:15 +00001017
Bram Moolenaar4770d092006-01-12 23:22:24 +00001018Summary:
1019 SFX L Y 2 ~
1020 SFX L 0 re [^x] ~
1021 SFX L 0 ro x ~
1022
1023The first line is a header and has four fields:
1024 SFX {flag} {combine} {count}
1025
1026{flag} The name used for the suffix. Mostly it's a single letter,
1027 but other characters can be used, see |spell-FLAG|.
1028
1029{combine} Can be 'Y' or 'N'. When 'Y' then the word plus suffix can
1030 also have a prefix. When 'N' then a prefix is not allowed.
1031
1032{count} The number of lines following. If this is wrong you will get
1033 an error message.
1034
1035For PFX the fields are exactly the same.
1036
1037The basic format for the following lines is:
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001038 SFX {flag} {strip} {add} {condition} {extra}
Bram Moolenaar4770d092006-01-12 23:22:24 +00001039
1040{flag} Must be the same as the {flag} used in the first line.
1041
1042{strip} Characters removed from the basic word. There is no check if
1043 the characters are actually there, only the length is used (in
1044 bytes). This better match the {condition}, otherwise strange
1045 things may happen. If the {strip} length is equal to or
1046 longer than the basic word the suffix won't be used.
1047 When {strip} is 0 (zero) then nothing is stripped.
1048
1049{add} Characters added to the basic word, after removing {strip}.
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001050 Optionally there is a '/' followed by flags. The flags apply
1051 to the word plus affix. See |spell-affix-flags|
Bram Moolenaar4770d092006-01-12 23:22:24 +00001052
1053{condition} A simplistic pattern. Only when this matches with a basic
1054 word will the suffix be used for that word. This is normally
1055 for using one suffix letter with different {add} and {strip}
1056 fields for words with different endings.
1057 When {condition} is a . (dot) there is no condition.
1058 The pattern may contain:
1059 - Literal characters.
1060 - A set of characters in []. [abc] matches a, b and c.
1061 A dash is allowed for a range [a-c], but this is
1062 Vim-specific.
1063 - A set of characters that starts with a ^, meaning the
1064 complement of the specified characters. [^abc] matches any
1065 character but a, b and c.
1066
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001067{extra} Optional extra text:
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001068 # comment Comment is ignored
1069 - Hunspell uses this, ignored
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001070
Bram Moolenaar4770d092006-01-12 23:22:24 +00001071For PFX the fields are the same, but the {strip}, {add} and {condition} apply
1072to the start of the word.
1073
1074Note: Myspell ignores any extra text after the relevant info. Vim requires
1075this text to start with a "#" so that mistakes don't go unnoticed. Example:
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +00001076
1077 SFX F 0 in [^i]n # Spion > Spionin ~
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001078 SFX F 0 nen in # Bauerin > Bauerinnen ~
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +00001079
Bram Moolenaarb4b43bb2014-09-19 16:04:11 +02001080However, to avoid lots of errors in affix files written for Myspell, you can
1081add the IGNOREEXTRA flag.
1082
Bram Moolenaar81f1ecb2005-08-25 21:27:31 +00001083Apparently Myspell allows an affix name to appear more than once. Since this
1084might also be a mistake, Vim checks for an extra "S". The affix files for
1085Myspell that use this feature apparently have this flag. Example:
1086
1087 SFX a Y 1 S ~
1088 SFX a 0 an . ~
1089
1090 SFX a Y 2 S ~
1091 SFX a 0 en . ~
1092 SFX a 0 on . ~
1093
Bram Moolenaar4770d092006-01-12 23:22:24 +00001094
1095AFFIX FLAGS *spell-affix-flags*
1096
1097This is a feature that comes from Hunspell: The affix may specify flags. This
1098works similar to flags specified on a basic word. The flags apply to the
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001099basic word plus the affix (but there are restrictions). Example:
Bram Moolenaar4770d092006-01-12 23:22:24 +00001100
1101 SFX S Y 1 ~
1102 SFX S 0 s . ~
1103
1104 SFX A Y 1 ~
1105 SFX A 0 able/S . ~
1106
1107When the dictionary file contains "drink/AS" then these words are possible:
1108
1109 drink
1110 drinks uses S suffix
1111 drinkable uses A suffix
1112 drinkables uses A suffix and then S suffix
1113
1114Generally the flags of the suffix are added to the flags of the basic word,
1115both are used for the word plus suffix. But the flags of the basic word are
1116only used once for affixes, except that both one prefix and one suffix can be
1117used when both support combining.
1118
1119Specifically, the affix flags can be used for:
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001120- Suffixes on suffixes, as in the example above. This works once, thus you
1121 can have two suffixes on a word (plus one prefix).
Bram Moolenaar4770d092006-01-12 23:22:24 +00001122- Making the word with the affix rare, by using the |spell-RARE| flag.
1123- Exclude the word with the affix from compounding, by using the
1124 |spell-COMPOUNDFORBIDFLAG| flag.
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001125- Allow the word with the affix to be part of a compound word on the side of
1126 the affix with the |spell-COMPOUNDPERMITFLAG|.
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001127- Use the NEEDCOMPOUND flag: word plus affix can only be used as part of a
1128 compound word. |spell-NEEDCOMPOUND|
1129- Compound flags: word plus affix can be part of a compound word at the end,
1130 middle, start, etc. The flags are combined with the flags of the basic
1131 word. |spell-compound|
1132- NEEDAFFIX: another affix is needed to make a valid word.
1133- CIRCUMFIX, as explained just below.
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001134
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001135
Bram Moolenaarb4b43bb2014-09-19 16:04:11 +02001136IGNOREEXTRA *spell-IGNOREEXTRA*
1137
1138Normally Vim gives an error for an extra field that does not start with '#'.
1139This avoids errors going unnoticed. However, some files created for Myspell
1140or Hunspell may contain many entries with an extra field. Use the IGNOREEXTRA
1141flag to avoid lots of errors.
1142
1143
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001144CIRCUMFIX *spell-CIRCUMFIX*
1145
1146The CIRCUMFIX flag means a prefix and suffix must be added at the same time.
Bram Moolenaard2ea7cf2021-05-30 20:54:13 +02001147If a prefix has the CIRCUMFIX flag then only suffixes with the CIRCUMFIX flag
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001148can be added, and the other way around.
Bram Moolenaard2ea7cf2021-05-30 20:54:13 +02001149An alternative is to only specify the suffix, and give that suffix two flags:
1150the required prefix and the NEEDAFFIX flag. |spell-NEEDAFFIX|
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001151
1152
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001153PFXPOSTPONE *spell-PFXPOSTPONE*
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001154
Bram Moolenaare13305e2005-06-19 22:54:15 +00001155When an affix file has very many prefixes that apply to many words it's not
1156possible to build the whole word list in memory. This applies to Hebrew (a
1157list with all words is over a Gbyte). In that case applying prefixes must be
1158postponed. This makes spell checking slower. It is indicated by this keyword
1159in the .aff file:
1160
1161 PFXPOSTPONE ~
1162
Bram Moolenaar8dff8182006-04-06 20:18:50 +00001163Only prefixes without a chop string and without flags can be postponed.
1164Prefixes with a chop string or with flags will still be included in the word
1165list. An exception if the chop string is one character and equal to the last
1166character of the added string, but in lower case. Thus when the chop string
1167is used to allow the following word to start with an upper case letter.
Bram Moolenaare13305e2005-06-19 22:54:15 +00001168
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001169
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001170WORDS WITH A SLASH *spell-SLASH*
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001171
1172The slash is used in the .dic file to separate the basic word from the affix
Bram Moolenaar33aec762006-01-22 23:30:12 +00001173letters and other flags. Unfortunately, this means you cannot use a slash in
Bram Moolenaar9ba7e172013-07-17 22:37:26 +02001174a word. Thus "TCP/IP" is not a word but "TCP" with the flags "IP". To include
Bram Moolenaar33aec762006-01-22 23:30:12 +00001175a slash in the word put a backslash before it: "TCP\/IP". In the rare case
1176you want to use a backslash inside a word you need to use two backslashes.
1177Any other use of the backslash is reserved for future expansion.
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001178
1179
Bram Moolenaar1cbe5f72005-12-29 22:51:09 +00001180KEEP-CASE WORDS *spell-KEEPCASE*
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001181
Bram Moolenaar1cbe5f72005-12-29 22:51:09 +00001182In the affix file a KEEPCASE line can be used to define the affix name used
1183for keep-case words. Example:
Bram Moolenaar45eeb132005-06-06 21:59:07 +00001184
Bram Moolenaar1cbe5f72005-12-29 22:51:09 +00001185 KEEPCASE = ~
Bram Moolenaar45eeb132005-06-06 21:59:07 +00001186
Bram Moolenaar4770d092006-01-12 23:22:24 +00001187This flag is not supported by Myspell. It has the meaning that case matters.
1188This can be used if the word does not have the first letter in upper case at
1189the start of a sentence. Example:
1190
1191 word list matches does not match ~
1192 's morgens/= 's morgens 'S morgens 's Morgens 'S MORGENS
1193 's Morgens 's Morgens 'S MORGENS 'S morgens 's morgens
1194
1195The flag can also be used to avoid that the word matches when it is in all
1196upper-case letters.
Bram Moolenaar45eeb132005-06-06 21:59:07 +00001197
Bram Moolenaare13305e2005-06-19 22:54:15 +00001198
Bram Moolenaar1cbe5f72005-12-29 22:51:09 +00001199RARE WORDS *spell-RARE*
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001200
Bram Moolenaar1cbe5f72005-12-29 22:51:09 +00001201In the affix file a RARE line can be used to define the affix name used for
Bram Moolenaar45eeb132005-06-06 21:59:07 +00001202rare words. Example:
1203
Bram Moolenaar1cbe5f72005-12-29 22:51:09 +00001204 RARE ? ~
Bram Moolenaar45eeb132005-06-06 21:59:07 +00001205
1206Rare words are highlighted differently from bad words. This is to be used for
1207words that are correct for the language, but are hardly ever used and could be
Bram Moolenaar30abd282005-06-22 22:35:10 +00001208a typing mistake anyway. When the same word is found as good it won't be
1209highlighted as rare.
1210
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001211This flag can also be used on an affix, so that a basic word is not rare but
1212the basic word plus affix is rare |spell-affix-flags|. However, if the word
1213also appears as a good word in another way (e.g., in another region) it won't
1214be marked as rare.
1215
Bram Moolenaar30abd282005-06-22 22:35:10 +00001216
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001217BAD WORDS *spell-BAD*
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001218
Bram Moolenaar30abd282005-06-22 22:35:10 +00001219In the affix file a BAD line can be used to define the affix name used for
1220bad words. Example:
1221
1222 BAD ! ~
1223
1224This can be used to exclude words that would otherwise be good. For example
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +00001225"the the" in the .dic file:
1226
1227 the the/! ~
1228
1229Once a word has been marked as bad it won't be undone by encountering the same
1230word as good.
Bram Moolenaar45eeb132005-06-06 21:59:07 +00001231
Bram Moolenaar4770d092006-01-12 23:22:24 +00001232The flag also applies to the word with affixes, thus this can be used to mark
1233a whole bunch of related words as bad.
1234
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001235 *spell-FORBIDDENWORD*
1236FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
1237
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001238 *spell-NEEDAFFIX*
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001239The NEEDAFFIX flag is used to require that a word is used with an affix. The
Bram Moolenaar4770d092006-01-12 23:22:24 +00001240word itself is not a good word (unless there is an empty affix). Example:
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001241
1242 NEEDAFFIX + ~
1243
Bram Moolenaar45eeb132005-06-06 21:59:07 +00001244
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001245COMPOUND WORDS *spell-compound*
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001246
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001247A compound word is a longer word made by concatenating words that appear in
1248the .dic file. To specify which words may be concatenated a character is
1249used. This character is put in the list of affixes after the word. We will
1250call this character a flag here. Obviously these flags must be different from
1251any affix IDs used.
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001252
1253 *spell-COMPOUNDFLAG*
Bram Moolenaar4770d092006-01-12 23:22:24 +00001254The Myspell compatible method uses one flag, specified with COMPOUNDFLAG. All
1255words with this flag combine in any order. This means there is no control
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001256over which word comes first. Example:
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001257 COMPOUNDFLAG c ~
1258
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001259 *spell-COMPOUNDRULE*
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001260A more advanced method to specify how compound words can be formed uses
1261multiple items with multiple flags. This is not compatible with Myspell 3.0.
1262Let's start with an example:
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001263 COMPOUNDRULE c+ ~
1264 COMPOUNDRULE se ~
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001265
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001266The first line defines that words with the "c" flag can be concatenated in any
1267order. The second line defines compound words that are made of one word with
1268the "s" flag and one word with the "e" flag. With this dictionary:
1269 bork/c ~
1270 onion/s ~
1271 soup/e ~
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001272
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001273You can make these words:
1274 bork
1275 borkbork
1276 borkborkbork
1277 (etc.)
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001278 onion
1279 soup
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001280 onionsoup
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001281
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001282The COMPOUNDRULE item may appear multiple times. The argument is made out of
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001283one or more groups, where each group can be:
1284 one flag e.g., c
1285 alternate flags inside [] e.g., [abc]
1286Optionally this may be followed by:
1287 * the group appears zero or more times, e.g., sm*e
1288 + the group appears one or more times, e.g., c+
Bram Moolenaar251e1912011-06-19 05:09:16 +02001289 ? the group appears zero times or once, e.g., x?
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001290
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001291This is similar to the regexp pattern syntax (but not the same!). A few
1292examples with the sequence of word flags they require:
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001293 COMPOUNDRULE x+ x xx xxx etc.
1294 COMPOUNDRULE yz yz
1295 COMPOUNDRULE x+z xz xxz xxxz etc.
1296 COMPOUNDRULE yx+ yx yxx yxxx etc.
Bram Moolenaar251e1912011-06-19 05:09:16 +02001297 COMPOUNDRULE xy?z xz xyz
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001298
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001299 COMPOUNDRULE [abc]z az bz cz
1300 COMPOUNDRULE [abc]+z az aaz abaz bz baz bcbz cz caz cbaz etc.
1301 COMPOUNDRULE a[xyz]+ ax axx axyz ay ayx ayzz az azy azxy etc.
1302 COMPOUNDRULE sm*e se sme smme smmme etc.
1303 COMPOUNDRULE s[xyz]*e se sxe sxye sxyxe sye syze sze szye szyxe etc.
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001304
Bram Moolenaara6c840d2005-08-22 22:59:46 +00001305A specific example: Allow a compound to be made of two words and a dash:
1306 In the .aff file:
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001307 COMPOUNDRULE sde ~
Bram Moolenaara6c840d2005-08-22 22:59:46 +00001308 NEEDAFFIX x ~
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001309 COMPOUNDWORDMAX 3 ~
Bram Moolenaara6c840d2005-08-22 22:59:46 +00001310 COMPOUNDMIN 1 ~
1311 In the .dic file:
1312 start/s ~
1313 end/e ~
1314 -/xd ~
1315
1316This allows for the word "start-end", but not "startend".
1317
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001318An additional implied rule is that, without further flags, a word with a
1319prefix cannot be compounded after another word, and a word with a suffix
1320cannot be compounded with a following word. Thus the affix cannot appear
1321on the inside of a compound word. This can be changed with the
1322|spell-COMPOUNDPERMITFLAG|.
1323
Bram Moolenaar4770d092006-01-12 23:22:24 +00001324 *spell-NEEDCOMPOUND*
1325The NEEDCOMPOUND flag is used to require that a word is used as part of a
1326compound word. The word itself is not a good word. Example:
1327
1328 NEEDCOMPOUND & ~
1329
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001330 *spell-ONLYINCOMPOUND*
1331The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001332compatibility with Hunspell.
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001333
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001334 *spell-COMPOUNDMIN*
Bram Moolenaarac6e65f2005-08-29 22:25:38 +00001335The minimal character length of a word used for compounding is specified with
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001336COMPOUNDMIN. Example:
1337 COMPOUNDMIN 5 ~
1338
Bram Moolenaarac6e65f2005-08-29 22:25:38 +00001339When omitted there is no minimal length. Obviously you could just leave out
1340the compound flag from short words instead, this feature is present for
1341compatibility with Myspell.
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001342
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001343 *spell-COMPOUNDWORDMAX*
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001344The maximum number of words that can be concatenated into a compound word is
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001345specified with COMPOUNDWORDMAX. Example:
1346 COMPOUNDWORDMAX 3 ~
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001347
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001348When omitted there is no maximum. It applies to all compound words.
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001349
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001350To set a limit for words with specific flags make sure the items in
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001351COMPOUNDRULE where they appear don't allow too many words.
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001352
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001353 *spell-COMPOUNDSYLMAX*
1354The maximum number of syllables that a compound word may contain is specified
1355with COMPOUNDSYLMAX. Example:
1356 COMPOUNDSYLMAX 6 ~
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001357
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001358This has no effect if there is no SYLLABLE item. Without COMPOUNDSYLMAX there
1359is no limit on the number of syllables.
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001360
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001361If both COMPOUNDWORDMAX and COMPOUNDSYLMAX are defined, a compound word is
Bram Moolenaara6c840d2005-08-22 22:59:46 +00001362accepted if it fits one of the criteria, thus is either made from up to
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001363COMPOUNDWORDMAX words or contains up to COMPOUNDSYLMAX syllables.
Bram Moolenaara6c840d2005-08-22 22:59:46 +00001364
Bram Moolenaar4770d092006-01-12 23:22:24 +00001365 *spell-COMPOUNDFORBIDFLAG*
1366The COMPOUNDFORBIDFLAG specifies a flag that can be used on an affix. It
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001367means that the word plus affix cannot be used in a compound word. Example:
1368 affix file:
1369 COMPOUNDFLAG c ~
1370 COMPOUNDFORBIDFLAG x ~
1371 SFX a Y 2 ~
1372 SFX a 0 s . ~
1373 SFX a 0 ize/x . ~
1374 dictionary:
1375 word/c ~
1376 util/ac ~
1377
1378This allows for "wordutil" and "wordutils" but not "wordutilize".
Bram Moolenaar18144c82006-04-12 21:52:12 +00001379Note: this doesn't work for postponed prefixes yet.
Bram Moolenaar4770d092006-01-12 23:22:24 +00001380
1381 *spell-COMPOUNDPERMITFLAG*
1382The COMPOUNDPERMITFLAG specifies a flag that can be used on an affix. It
1383means that the word plus affix can also be used in a compound word in a way
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001384where the affix ends up halfway the word. Without this flag that is not
1385allowed.
Bram Moolenaar18144c82006-04-12 21:52:12 +00001386Note: this doesn't work for postponed prefixes yet.
Bram Moolenaar4770d092006-01-12 23:22:24 +00001387
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001388 *spell-COMPOUNDROOT*
1389The COMPOUNDROOT flag is used for words in the dictionary that are already a
1390compound. This means it counts for two words when checking the compounding
1391rules. Can also be used for an affix to count the affix as a compounding
1392word.
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001393
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001394 *spell-CHECKCOMPOUNDPATTERN*
1395CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
1396position where two words are compounded together forbids the compound.
1397For example:
1398 CHECKCOMPOUNDPATTERN o e ~
1399
1400This forbids compounding if the first word ends in "o" and the second word
1401starts with "e".
1402
1403The arguments must be plain text, no patterns are actually supported, despite
1404the item name. Case is always ignored.
1405
1406The Hunspell feature to use three arguments and flags is not supported.
1407
Bram Moolenaar7b877b32016-01-09 13:51:34 +01001408 *spell-NOCOMPOUNDSUGS*
1409This item indicates that using compounding to make suggestions is not a good
1410idea. Use this when compounding is used with very short or one-character
1411words. E.g. to make numbers out of digits. Without this flag creating
1412suggestions would spend most time trying all kind of weird compound words.
1413
1414 NOCOMPOUNDSUGS ~
1415
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001416 *spell-SYLLABLE*
1417The SYLLABLE item defines characters or character sequences that are used to
1418count the number of syllables in a word. Example:
Bram Moolenaarab943432018-03-29 18:27:07 +02001419 SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001420
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001421Before the first slash is the set of characters that are counted for one
1422syllable, also when repeated and mixed, until the next character that is not
1423in this set. After the slash come sequences of characters that are counted
1424for one syllable. These are preferred over using characters from the set.
1425With the example "ideeen" has three syllables, counted by "i", "ee" and "e".
1426
1427Only case-folded letters need to be included.
1428
Bram Moolenaarc81e5e72007-05-05 18:24:42 +00001429Another way to restrict compounding was mentioned above: Adding the
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001430|spell-COMPOUNDFORBIDFLAG| flag to an affix causes all words that are made
Bram Moolenaar9ba7e172013-07-17 22:37:26 +02001431with that affix to not be used for compounding.
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001432
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001433
1434UNLIMITED COMPOUNDING *spell-NOBREAK*
1435
1436For some languages, such as Thai, there is no space in between words. This
1437looks like all words are compounded. To specify this use the NOBREAK item in
1438the affix file, without arguments:
1439 NOBREAK ~
1440
1441Vim will try to figure out where one word ends and a next starts. When there
1442are spelling mistakes this may not be quite right.
1443
Bram Moolenaarae5bce12005-08-15 21:41:48 +00001444
Bram Moolenaar4770d092006-01-12 23:22:24 +00001445 *spell-COMMON*
1446Common words can be specified with the COMMON item. This will give better
1447suggestions when editing a short file. Example:
1448
Bram Moolenaar3d1cde82020-08-15 18:55:18 +02001449 COMMON the of to and a in is it you that he she was for on are ~
Bram Moolenaar4770d092006-01-12 23:22:24 +00001450
1451The words must be separated by white space, up to 25 per line.
1452When multiple regions are specified in a ":mkspell" command the common words
1453for all regions are combined and used for all regions.
1454
1455 *spell-NOSPLITSUGS*
Bram Moolenaarfd2ac762006-03-01 22:09:21 +00001456This item indicates that splitting a word to make suggestions is not a good
1457idea. Split-word suggestions will appear only when there are few similar
1458words.
Bram Moolenaar4770d092006-01-12 23:22:24 +00001459
1460 NOSPLITSUGS ~
1461
1462 *spell-NOSUGGEST*
1463The flag specified with NOSUGGEST can be used for words that will not be
1464suggested. Can be used for obscene words.
1465
1466 NOSUGGEST % ~
1467
Bram Moolenaar4770d092006-01-12 23:22:24 +00001468
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001469REPLACEMENTS *spell-REP*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001470
1471In the affix file REP items can be used to define common mistakes. This is
1472used to make spelling suggestions. The items define the "from" text and the
1473"to" replacement. Example:
1474
1475 REP 4 ~
1476 REP f ph ~
1477 REP ph f ~
1478 REP k ch ~
1479 REP ch k ~
1480
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00001481The first line specifies the number of REP lines following. Vim ignores the
Bram Moolenaar4770d092006-01-12 23:22:24 +00001482number, but it must be there (for compatibility with Myspell).
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00001483
Bram Moolenaard042c562005-06-30 22:04:15 +00001484Don't include simple one-character replacements or swaps. Vim will try these
1485anyway. You can include whole words if you want to, but you might want to use
1486the "file:" item in 'spellsuggest' instead.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001487
Bram Moolenaar1e015462005-09-25 22:16:38 +00001488You can include a space by using an underscore:
1489
1490 REP the_the the ~
1491
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001492
Bram Moolenaara40ceaf2006-01-13 22:35:40 +00001493SIMILAR CHARACTERS *spell-MAP* *E783*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001494
Bram Moolenaard042c562005-06-30 22:04:15 +00001495In the affix file MAP items can be used to define letters that are very much
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001496alike. This is mostly used for a letter with different accents. This is used
1497to prefer suggestions with these letters substituted. Example:
1498
1499 MAP 2 ~
Bram Moolenaarab943432018-03-29 18:27:07 +02001500 MAP eéëêè ~
1501 MAP uüùúû ~
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001502
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00001503The first line specifies the number of MAP lines following. Vim ignores the
1504number, but the line must be there.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001505
Bram Moolenaard042c562005-06-30 22:04:15 +00001506Each letter must appear in only one of the MAP items. It's a bit more
1507efficient if the first letter is ASCII or at least one without accents.
Bram Moolenaare7566042005-06-17 22:00:15 +00001508
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001509
Bram Moolenaar4770d092006-01-12 23:22:24 +00001510.SUG FILE *spell-NOSUGFILE*
1511
1512When soundfolding is specified in the affix file then ":mkspell" will normally
Bram Moolenaard12f5c12006-01-25 22:10:52 +00001513produce a .sug file next to the .spl file. This file is used to find
1514suggestions by their sound-a-like form quickly. At the cost of a lot of
1515memory (the amount depends on the number of words, |:mkspell| will display an
1516estimate when it's done).
Bram Moolenaar4770d092006-01-12 23:22:24 +00001517
1518To avoid producing a .sug file use this item in the affix file:
1519
1520 NOSUGFILE ~
1521
Bram Moolenaard12f5c12006-01-25 22:10:52 +00001522Users can simply omit the .sug file if they don't want to use it.
1523
Bram Moolenaar4770d092006-01-12 23:22:24 +00001524
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001525SOUND-A-LIKE *spell-SAL*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001526
1527In the affix file SAL items can be used to define the sounds-a-like mechanism
1528to be used. The main items define the "from" text and the "to" replacement.
Bram Moolenaard042c562005-06-30 22:04:15 +00001529Simplistic example:
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001530
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001531 SAL CIA X ~
1532 SAL CH X ~
1533 SAL C K ~
1534 SAL K K ~
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001535
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +00001536There are a few rules and this can become quite complicated. An explanation
Bram Moolenaard042c562005-06-30 22:04:15 +00001537how it works can be found in the Aspell manual:
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001538http://aspell.net/man-html/Phonetic-Code.html.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +00001539
1540There are a few special items:
1541
1542 SAL followup true ~
1543 SAL collapse_result true ~
1544 SAL remove_accents true ~
1545
1546"1" has the same meaning as "true". Any other value means "false".
1547
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001548
Bram Moolenaar6f16eb82005-08-23 21:02:42 +00001549SIMPLE SOUNDFOLDING *spell-SOFOFROM* *spell-SOFOTO*
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001550
1551The SAL mechanism is complex and slow. A simpler mechanism is mapping all
1552characters to another character, mapping similar sounding characters to the
1553same character. At the same time this does case folding. You can not have
Bram Moolenaard042c562005-06-30 22:04:15 +00001554both SAL items and simple soundfolding.
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001555
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +00001556There are two items required: one to specify the characters that are mapped
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001557and one that specifies the characters they are mapped to. They must have
1558exactly the same number of characters. Example:
1559
1560 SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ~
1561 SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkes ~
1562
1563In the example all vowels are mapped to the same character 'e'. Another
Bram Moolenaard042c562005-06-30 22:04:15 +00001564method would be to leave out all vowels. Some characters that sound nearly
1565the same and are often mixed up, such as 'm' and 'n', are mapped to the same
1566character. Don't do this too much, all words will start looking alike.
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001567
1568Characters that do not appear in SOFOFROM will be left out, except that all
1569white space is replaced by one space. Sequences of the same character in
1570SOFOFROM are replaced by one.
1571
1572You can use the |soundfold()| function to try out the results. Or set the
Bram Moolenaarcc016f52005-12-10 20:23:46 +00001573'verbose' option to see the score in the output of the |z=| command.
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001574
1575
Bram Moolenaar4770d092006-01-12 23:22:24 +00001576UNSUPPORTED ITEMS *spell-affix-not-supported*
1577
1578These items appear in the affix file of other spell checkers. In Vim they are
1579ignored, not supported or defined in another way.
1580
1581ACCENT (Hunspell) *spell-ACCENT*
1582 Use MAP instead. |spell-MAP|
1583
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001584BREAK (Hunspell) *spell-BREAK*
1585 Define break points. Unclear how it works exactly.
1586 Not supported.
1587
Bram Moolenaar4770d092006-01-12 23:22:24 +00001588CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
1589 Disallow uppercase letters at compound word boundaries.
1590 Not supported.
1591
1592CHECKCOMPOUNDDUP (Hunspell) *spell-CHECKCOMPOUNDDUP*
1593 Disallow using the same word twice in a compound. Not
1594 supported.
1595
1596CHECKCOMPOUNDREP (Hunspell) *spell-CHECKCOMPOUNDREP*
1597 Something about using REP items and compound words. Not
1598 supported.
1599
1600CHECKCOMPOUNDTRIPLE (Hunspell) *spell-CHECKCOMPOUNDTRIPLE*
1601 Forbid three identical characters when compounding. Not
1602 supported.
1603
Bram Moolenaar9712ff12022-09-18 13:04:22 +01001604CHECKSHARPS (Hunspell) *spell-CHECKSHARPS*
Bram Moolenaar2a953fc2019-01-26 17:41:47 +01001605 SS letter pair in uppercased (German) words may be upper case
1606 sharp s (ß). Not supported.
1607
Bram Moolenaar4770d092006-01-12 23:22:24 +00001608COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
1609 Enables using two prefixes. Not supported.
1610
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001611COMPOUND (Hunspell) *spell-COMPOUND*
Bram Moolenaarc81e5e72007-05-05 18:24:42 +00001612 This is one line with the count of COMPOUND items, followed by
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001613 that many COMPOUND lines with a pattern.
1614 Remove the first line with the count and rename the other
1615 items to COMPOUNDRULE |spell-COMPOUNDRULE|
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001616
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001617COMPOUNDFIRST (Hunspell) *spell-COMPOUNDFIRST*
1618 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1619
Bram Moolenaar4770d092006-01-12 23:22:24 +00001620COMPOUNDBEGIN (Hunspell) *spell-COMPOUNDBEGIN*
Bram Moolenaar2a953fc2019-01-26 17:41:47 +01001621 Words signed with COMPOUNDBEGIN may be first elements in
1622 compound words.
1623 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
1624
1625COMPOUNDLAST (Hunspell) *spell-COMPOUNDLAST*
1626 Words signed with COMPOUNDLAST may be last elements in
1627 compound words.
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001628 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
Bram Moolenaar4770d092006-01-12 23:22:24 +00001629
1630COMPOUNDEND (Hunspell) *spell-COMPOUNDEND*
Bram Moolenaar2a953fc2019-01-26 17:41:47 +01001631 Probably the same as COMPOUNDLAST
Bram Moolenaar4770d092006-01-12 23:22:24 +00001632
1633COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
Bram Moolenaar2a953fc2019-01-26 17:41:47 +01001634 Words signed with COMPOUNDMIDDLE may be middle elements in
1635 compound words.
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001636 Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
Bram Moolenaar4770d092006-01-12 23:22:24 +00001637
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001638COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
1639 Number of COMPOUNDRULE lines following. Ignored, but the
1640 argument must be a number.
1641
Bram Moolenaar4770d092006-01-12 23:22:24 +00001642COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
1643 Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
1644 |spell-COMPOUNDSYLMAX|
1645
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001646KEY (Hunspell) *spell-KEY*
1647 Define characters that are close together on the keyboard.
1648 Used to give better suggestions. Not supported.
Bram Moolenaar6aa8cea2017-06-05 14:44:35 +02001649
Bram Moolenaar4770d092006-01-12 23:22:24 +00001650LANG (Hunspell) *spell-LANG*
1651 This specifies language-specific behavior. This actually
1652 moves part of the language knowledge into the program,
1653 therefore Vim does not support it. Each language property
1654 must be specified separately.
1655
1656LEMMA_PRESENT (Hunspell) *spell-LEMMA_PRESENT*
Bram Moolenaar899dddf2006-03-26 21:06:50 +00001657 Only needed for morphological analysis.
Bram Moolenaar4770d092006-01-12 23:22:24 +00001658
1659MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
Bram Moolenaar9f94b052008-11-30 20:12:46 +00001660 Set number of n-gram suggestions. Not supported.
Bram Moolenaar4770d092006-01-12 23:22:24 +00001661
1662PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
1663 Use NEEDAFFIX instead. |spell-NEEDAFFIX|
1664
1665SUGSWITHDOTS (Hunspell) *spell-SUGSWITHDOTS*
1666 Adds dots to suggestions. Vim doesn't need this.
1667
1668SYLLABLENUM (Hunspell) *spell-SYLLABLENUM*
1669 Not supported.
1670
1671TRY (Myspell, Hunspell, others) *spell-TRY*
1672 Vim does not use the TRY item, it is ignored. For making
Bram Moolenaara94bc432006-03-10 21:42:59 +00001673 suggestions the actual characters in the words are used, that
1674 is much more efficient.
Bram Moolenaar4770d092006-01-12 23:22:24 +00001675
Bram Moolenaar4770d092006-01-12 23:22:24 +00001676WORDCHARS (Hunspell) *spell-WORDCHARS*
1677 Used to recognize words. Vim doesn't need it, because there
1678 is no need to separate words before checking them (using a
1679 trie instead of a hashtable).
1680
Bram Moolenaar91f84f62018-07-29 15:07:52 +02001681 vim:tw=78:sw=4:ts=8:noet:ft=help:norl: