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