spell.txt 63 KB

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