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