spell.txt 67 KB

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