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