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