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