359
|
1 *spell.txt* For Vim version 7.0aa. Last change: 2005 Jun 25
|
221
|
2
|
|
3
|
|
4 VIM REFERENCE MANUAL by Bram Moolenaar
|
|
5
|
|
6
|
|
7 Spell checking *spell*
|
|
8
|
|
9 1. Quick start |spell-quickstart|
|
237
|
10 2. Generating a spell file |spell-mkspell|
|
314
|
11 3. Spell file format |spell-file-format|
|
221
|
12
|
|
13 {Vi does not have any of these commands}
|
|
14
|
|
15 Spell checking is not available when the |+syntax| feature has been disabled
|
|
16 at compile time.
|
|
17
|
|
18 ==============================================================================
|
|
19 1. Quick start *spell-quickstart*
|
|
20
|
|
21 This command switches on spell checking: >
|
|
22
|
|
23 :setlocal spell spelllang=en_us
|
|
24
|
237
|
25 This switches on the 'spell' option and specifies to check for US English.
|
221
|
26
|
|
27 The words that are not recognized are highlighted with one of these:
|
333
|
28 SpellBad word not recognized |hl-SpellBad|
|
|
29 SpellRare rare word |hl-SpellRare|
|
|
30 SpellLocal wrong spelling for selected region |hl-SpellLocal|
|
221
|
31
|
237
|
32 Vim only checks words for spelling, there is no grammar check.
|
|
33
|
|
34 To search for the next misspelled word:
|
|
35
|
|
36 *]s* *E756*
|
|
37 ]s Move to next misspelled word after the cursor.
|
253
|
38 A count before the command can be used to repeat.
|
|
39 This uses the @Spell and @NoSpell clusters from syntax
|
|
40 highlighting, see |spell-syntax|.
|
237
|
41
|
|
42 *[s*
|
253
|
43 [s Like "]s" but search backwards, find the misspelled
|
348
|
44 word before the cursor. Doesn't recognize words
|
|
45 split over two lines, thus may stop at words that are
|
|
46 not highlighted as bad.
|
253
|
47
|
|
48 *]S*
|
|
49 ]S Like "]s" but only stop at bad words, not at rare
|
|
50 words or words for another region.
|
|
51
|
|
52 *[S*
|
|
53 [S Like "]S" but search backwards.
|
237
|
54
|
221
|
55
|
323
|
56 To add words to your own word list: *E764*
|
314
|
57
|
|
58 *zg*
|
|
59 zg Add word under the cursor as a good word to
|
|
60 'spellfile'. In Visual mode the selected characters
|
|
61 are added as a word (including white space!).
|
|
62
|
|
63 *zw*
|
|
64 zw Add word under the cursor as a wrong (bad) word to
|
|
65 'spellfile'. In Visual mode the selected characters
|
|
66 are added as a word (including white space!).
|
|
67
|
333
|
68 *:spe* *:spellgood*
|
|
69 :spe[llgood] {word} Add [word} as a good word to 'spellfile'.
|
314
|
70
|
333
|
71 *:spellw* *:spellwrong*
|
314
|
72 :spellw[rong] {word} Add [word} as a wrong (bad) word to 'spellfile'.
|
|
73
|
359
|
74 After adding a word to 'spellfile' with the above commands its associated
|
|
75 ".spl" file will automatically be updated. If you edit 'spellfile' manually
|
|
76 you need to use the |:mkspell| command. This sequence of commands mostly
|
|
77 works well: >
|
|
78 :exe 'e ' . &spellfile
|
|
79 < (make changes to the spell file) >
|
|
80 :mkspell! %
|
|
81
|
|
82 More details about the 'spellfile' format below |spell-wordlist-format|.
|
314
|
83
|
|
84
|
323
|
85 Finding suggestions for bad words:
|
|
86
|
|
87 *z?*
|
348
|
88 z? For the word under/after the cursor suggest correctly
|
|
89 spelled words. This also works to find alternative
|
|
90 for words that are not highlighted as bad words.
|
|
91 The results are sorted on similarity to the word
|
|
92 under/after the cursor.
|
323
|
93 This may take a long time. Hit CTRL-C when you are
|
|
94 bored.
|
|
95 You can enter the number of your choice or press
|
|
96 <Enter> if you don't want to replace.
|
327
|
97 If 'verbose' is non-zero a score will be displayed to
|
|
98 indicate the likeliness to the badly spelled word (the
|
|
99 higher the score the more different).
|
344
|
100 When a word was replaced the redo command "." will
|
|
101 repeat the word replacement. This works like "ciw",
|
|
102 the good word and <Esc>.
|
|
103
|
|
104 The 'spellsuggest' option influences how the list of suggestions is generated
|
|
105 and sorted. See |'spellsuggest'|.
|
323
|
106
|
|
107
|
227
|
108 PERFORMANCE
|
|
109
|
320
|
110 Note that Vim does on-the-fly spell checking. To make this work fast the
|
237
|
111 word list is loaded in memory. Thus this uses a lot of memory (1 Mbyte or
|
320
|
112 more). There might also be a noticeable delay when the word list is loaded,
|
353
|
113 which happens when 'spell' is set and when 'spelllang' is set while 'spell'
|
|
114 was already set. Each word list is only loaded once, they are not deleted
|
|
115 when 'spelllang' is made empty or 'spell' is reset. When 'encoding' is set
|
|
116 all the word lists are reloaded, thus you may notice a delay then too.
|
227
|
117
|
|
118
|
221
|
119 REGIONS
|
|
120
|
|
121 A word may be spelled differently in various regions. For example, English
|
|
122 comes in (at least) these variants:
|
|
123
|
|
124 en all regions
|
247
|
125 en_au Australia
|
|
126 en_ca Canada
|
221
|
127 en_gb Great Britain
|
247
|
128 en_nz New Zealand
|
|
129 en_us USA
|
221
|
130
|
|
131 Words that are not used in one region but are used in another region are
|
333
|
132 highlighted with SpellLocal |hl-SpellLocal|.
|
221
|
133
|
237
|
134 Always use lowercase letters for the language and region names.
|
221
|
135
|
320
|
136 When adding a word with |zg| or another command it's always added for all
|
|
137 regions. You can change that by manually editing the 'spellfile'. See
|
|
138 |spell-wordlist-format|.
|
|
139
|
221
|
140
|
353
|
141 SPELL FILES *spell-load*
|
221
|
142
|
|
143 Vim searches for spell files in the "spell" subdirectory of the directories in
|
320
|
144 'runtimepath'. The name is: LL.EEE.spl, where:
|
237
|
145 LL the language name
|
|
146 EEE the value of 'encoding'
|
221
|
147
|
353
|
148 The value for "LL" comes from 'spelllang', but excludes the region name.
|
|
149 Examples:
|
|
150 'spelllang' LL ~
|
|
151 en_us en
|
|
152 en-rare en-rare
|
|
153 medical_ca medical
|
|
154
|
320
|
155 Only the first file is loaded, the one that is first in 'runtimepath'. If
|
|
156 this succeeds then additionally files with the name LL.EEE.add.spl are loaded.
|
|
157 All the ones that are found are used.
|
|
158
|
353
|
159 Additionally, the file related to 'spellfile' is loaded. This is the file
|
|
160 that |zg| and |zw| add good and wrong words to.
|
|
161
|
242
|
162 Exceptions:
|
|
163 - Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign doesn't
|
|
164 matter for spelling.
|
|
165 - When no spell file for 'encoding' is found "ascii" is tried. This only
|
|
166 works for languages where nearly all words are ASCII, such as English. It
|
|
167 helps when 'encoding' is not "latin1", such as iso-8859-2, and English text
|
320
|
168 is being edited. For the ".add" files the same name as the found main
|
|
169 spell file is used.
|
|
170
|
|
171 For example, with these values:
|
|
172 'runtimepath' is "~/.vim,/usr/share/vim70,~/.vim/after"
|
|
173 'encoding' is "iso-8859-2"
|
|
174 'spelllang' is "pl"
|
|
175
|
|
176 Vim will look for:
|
|
177 1. ~/.vim/spell/pl.iso-8859-2.spl
|
|
178 2. /usr/share/vim70/spell/pl.iso-8859-2.spl
|
|
179 3. ~/.vim/spell/pl.iso-8859-2.add.spl
|
|
180 4. /usr/share/vim70/spell/pl.iso-8859-2.add.spl
|
|
181 5. ~/.vim/after/spell/pl.iso-8859-2.add.spl
|
|
182
|
|
183 This assumes 1. is not found and 2. is found.
|
|
184
|
|
185 If 'encoding' is "latin1" Vim will look for:
|
|
186 1. ~/.vim/spell/pl.latin1.spl
|
|
187 2. /usr/share/vim70/spell/pl.latin1.spl
|
|
188 3. ~/.vim/after/spell/pl.latin1.spl
|
|
189 4. ~/.vim/spell/pl.ascii.spl
|
|
190 5. /usr/share/vim70/spell/pl.ascii.spl
|
|
191 6. ~/.vim/after/spell/pl.ascii.spl
|
|
192
|
|
193 This assumes none of them are found (Polish doesn't make sense when leaving
|
|
194 out the non-ASCII characters).
|
221
|
195
|
227
|
196 Spelling for EBCDIC is currently not supported.
|
|
197
|
237
|
198 A spell file might not be available in the current 'encoding'. See
|
|
199 |spell-mkspell| about how to create a spell file. Converting a spell file
|
242
|
200 with "iconv" will NOT work!
|
221
|
201
|
237
|
202 *E758* *E759*
|
|
203 When loading a spell file Vim checks that it is properly formatted. If you
|
242
|
204 get an error the file may be truncated, modified or intended for another Vim
|
|
205 version.
|
237
|
206
|
227
|
207
|
|
208 WORDS
|
|
209
|
|
210 Vim uses a fixed method to recognize a word. This is independent of
|
|
211 'iskeyword', so that it also works in help files and for languages that
|
|
212 include characters like '-' in 'iskeyword'. The word characters do depend on
|
|
213 'encoding'.
|
|
214
|
323
|
215 The table with word characters is stored in the main .spl file. Therefore it
|
|
216 matters what the current locale is when generating it! A .add.spl file does
|
359
|
217 not contain a word table though.
|
323
|
218
|
320
|
219 A word that starts with a digit is always ignored. That includes hex numbers
|
|
220 in the form 0xff and 0XFF.
|
227
|
221
|
|
222
|
348
|
223 WORD COMBINATIONS
|
|
224
|
|
225 It is possible to spell-check words that include a space. This is used to
|
|
226 recognize words that are invalid when used by themselves, e.g. for "et al.".
|
|
227 It can also be used to recognize "the the" and highlight it.
|
|
228
|
|
229 The number of spaces is irrelevant. In most cases a line break may also
|
|
230 appear. However, this makes it difficult to find out where to start checking
|
|
231 for spelling mistakes. When you make a change to one line and only that line
|
|
232 is redrawn Vim won't look in the previous line, thus when "et" is at the end
|
|
233 of the previous line "al." will be flagged as an error. And when you type
|
|
234 "the<CR>the" the highlighting doesn't appear until the first line is redrawn.
|
|
235 Use |CTRL-L| to redraw right away. "[s" will also stop at a word combination
|
|
236 with a line break.
|
|
237
|
|
238 When encountering a line break Vim skips characters such as '*', '>' and '"',
|
|
239 so that comments in C, shell and Vim code can be spell checked.
|
|
240
|
|
241
|
253
|
242 SYNTAX HIGHLIGHTING *spell-syntax*
|
227
|
243
|
|
244 Files that use syntax highlighting can specify where spell checking should be
|
|
245 done:
|
|
246
|
320
|
247 1. everywhere default
|
|
248 2. in specific items use "contains=@Spell"
|
|
249 3. everywhere but specific items use "contains=@NoSpell"
|
227
|
250
|
320
|
251 For the second method adding the @NoSpell cluster will disable spell checking
|
|
252 again. This can be used, for example, to add @Spell to the comments of a
|
|
253 program, and add @NoSpell for items that shouldn't be checked.
|
227
|
254
|
348
|
255
|
|
256 VIM SCRIPTS
|
|
257
|
|
258 If you want to write a Vim script that does something with spelling, you may
|
|
259 find these functions useful:
|
|
260
|
|
261 spellbadword() find badly spelled word at the cursor
|
|
262 spellsuggest() get list of spelling suggestions
|
|
263
|
221
|
264 ==============================================================================
|
237
|
265 2. Generating a spell file *spell-mkspell*
|
|
266
|
|
267 Vim uses a binary file format for spelling. This greatly speeds up loading
|
|
268 the word list and keeps it small.
|
|
269
|
|
270 You can create a Vim spell file from the .aff and .dic files that Myspell
|
|
271 uses. Myspell is used by OpenOffice.org and Mozilla. You should be able to
|
|
272 find them here:
|
|
273 http://lingucomponent.openoffice.org/spell_dic.html
|
348
|
274 You can also use a plain word list. The results are the same, the choice
|
|
275 depends on what you find.
|
221
|
276
|
341
|
277 Make sure your current locale is set properly, otherwise Vim doesn't know what
|
|
278 characters are upper/lower case letters. If the locale isn't available (e.g.,
|
|
279 when using an MS-Windows codepage on Unix) add tables to the .aff file
|
353
|
280 |spell-affix-chars|. If the .aff file doesn't define a table then the word
|
|
281 table of the currently active spelling is used. If spelling is not active
|
|
282 then Vim will try to guess.
|
341
|
283
|
353
|
284 *:mksp* *:mkspell*
|
|
285 :mksp[ell][!] [-ascii] {outname} {inname} ...
|
314
|
286 Generate a Vim spell file word lists. Example: >
|
|
287 :mkspell nl nl_NL.words
|
353
|
288 < *E751*
|
314
|
289 When {outname} ends in ".spl" it is used as the output
|
|
290 file name. Otherwise it should be a language name,
|
353
|
291 such as "en", without the region name. The file
|
|
292 written will be "{outname}.{encoding}.spl", where
|
|
293 {encoding} is the value of the 'encoding' option.
|
301
|
294
|
333
|
295 When the output file already exists [!] must be added
|
|
296 to overwrite it.
|
|
297
|
242
|
298 When the [-ascii] argument is present, words with
|
|
299 non-ascii characters are skipped. The resulting file
|
314
|
300 ends in "ascii.spl".
|
301
|
301
|
|
302 The input can be the Myspell format files {inname}.aff
|
|
303 and {inname}.dic. If {inname}.aff does not exist then
|
|
304 {inname} is used as the file name of a plain word
|
|
305 list.
|
|
306
|
237
|
307 Multiple {inname} arguments can be given to combine
|
|
308 regions into one Vim spell file. Example: >
|
|
309 :mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU
|
|
310 < This combines the English word lists for US, CA and AU
|
|
311 into one en.spl file.
|
|
312 Up to eight regions can be combined. *E754* *755*
|
323
|
313 The REP and SAL items of the first .aff file where
|
|
314 they appear are used. |spell-affix-REP|
|
|
315 |spell-affix-SAL|
|
237
|
316
|
348
|
317 This command uses a lot of memory, required to find
|
|
318 the optimal word tree (Polish requires a few hundred
|
|
319 Mbyte). The final result will be much smaller.
|
|
320
|
308
|
321 When the spell file was written all currently used
|
|
322 spell files will be reloaded.
|
|
323
|
314
|
324 :mksp[ell] [-ascii] {add-name}
|
|
325 Like ":mkspell" above, using {add-name} as the input
|
|
326 file and producing an output file that has ".spl"
|
|
327 appended.
|
|
328
|
|
329 Since you might want to change a Myspell word list for use with Vim the
|
|
330 following procedure is recommended:
|
237
|
331
|
|
332 1. Obtain the xx_YY.aff and xx_YY.dic files from Myspell.
|
|
333 2. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic.
|
|
334 3. Change the xx_YY.aff and xx_YY.dic files to remove bad words, add missing
|
258
|
335 words, define word characters with FOL/LOW/UPP, etc. The distributed
|
|
336 "src/spell/*.diff" files can be used.
|
|
337 4. Set 'encoding' to the desired encoding and use |:mkspell| to generate the
|
|
338 Vim spell file.
|
|
339 5. Try out the spell file with ":set spell spelllang=xx_YY".
|
221
|
340
|
237
|
341 When the Myspell files are updated you can merge the differences:
|
258
|
342 1. Obtain the new Myspell files as xx_YY.new.aff and xx_UU.new.dic.
|
|
343 2. Use Vimdiff to see what changed: >
|
237
|
344 vimdiff xx_YY.orig.dic xx_YY.new.dic
|
258
|
345 3. Take over the changes you like in xx_YY.dic.
|
237
|
346 You may also need to change xx_YY.aff.
|
258
|
347 4. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.new.aff.
|
237
|
348
|
353
|
349
|
|
350 SPELL FILE DUMP
|
|
351
|
|
352 If for some reason you want to check what words are supported by the currently
|
|
353 used spelling files, use this command:
|
|
354
|
|
355 *:spelldump* *:spelld*
|
|
356 :spelld[ump] Open a new window and fill it with all currently valid
|
|
357 words.
|
|
358 Note: For some languages the result may be huge and
|
|
359 Vim may run out of memory.
|
|
360
|
|
361 The format of the word list is used |spell-wordlist-format|. You should be
|
|
362 able to read it with ":mkspell" to generate one .spl file that includes all
|
|
363 the words.
|
|
364
|
|
365 Only words for the current region are included. No "/regions" line is
|
|
366 generated.
|
|
367
|
|
368 Comment lines are used to indicate which .spl file the words came from.
|
|
369
|
237
|
370 ==============================================================================
|
353
|
371 3. Spell file format *spell-file-format*
|
237
|
372
|
|
373 This is the format of the files that are used by the person who creates and
|
|
374 maintains a word list.
|
221
|
375
|
237
|
376 Note that we avoid the word "dictionary" here. That is because the goal of
|
|
377 spell checking differs from writing a dictionary (as in the book). For
|
|
378 spelling we need a list of words that are OK, thus need not to be highlighted.
|
|
379 Names will not appear in a dictionary, but do appear in a word list. And
|
|
380 some old words are rarely used and are common misspellings. These do appear
|
|
381 in a dictionary but not in a word list.
|
|
382
|
301
|
383 There are two formats: one with affix compression and one without. The files
|
|
384 with affix compression are used by Myspell (Mozilla and OpenOffice.org). This
|
|
385 requires two files, one with .aff and one with .dic extension. The second
|
|
386 format is a list of words.
|
|
387
|
|
388
|
320
|
389 FORMAT OF WORD LIST *spell-wordlist-format*
|
301
|
390
|
314
|
391 The words must appear one per line. That is all that is required.
|
|
392 Additionally the following items are recognized:
|
301
|
393 - Empty and blank lines are ignored.
|
|
394 - Lines starting with a # are ignored (comment lines).
|
308
|
395 - A line starting with "/encoding=", before any word, specifies the encoding
|
|
396 of the file. After the second '=' comes an encoding name. This tells Vim
|
|
397 to setup conversion from the specified encoding to 'encoding'.
|
320
|
398 - A line starting with "/regions=" specifies the region names that are
|
|
399 supported. Each region name must be two ASCII letters. The first one is
|
|
400 region 1. Thus "/regions=usca" has region 1 "us" and region 2 "ca".
|
|
401 In an addition word list the list should be equal to the main word list!
|
308
|
402 - A line starting with "/?" specifies a word that should be marked as rare.
|
|
403 - A line starting with "/!" specifies a word that should be marked as bad.
|
|
404 - A line starting with "/=" specifies a word where case must match exactly.
|
|
405 A "?" or "!" may be following: "/=?" and "/=!".
|
320
|
406 - Digits after "/" indicate the regions in which the word is valid. If no
|
|
407 regions are specified the word is valid in all regions.
|
314
|
408 - Other lines starting with '/' are reserved for future use. The ones that
|
|
409 are not recognized are ignored (but you do get a warning message).
|
301
|
410
|
320
|
411 Example:
|
|
412
|
|
413 # This is an example word list comment
|
|
414 /encoding=latin1 encoding of the file
|
|
415 /regions=uscagb regions "us", "ca" and "gb"
|
|
416 example word for all regions
|
|
417 /1blah word for region 1 "us"
|
344
|
418 /!vim bad word
|
320
|
419 /?3Campbell rare word in region 3 "gb"
|
|
420 /='s mornings keep-case word
|
|
421
|
301
|
422
|
|
423 FORMAT WITH AFFIX COMPRESSION
|
|
424
|
237
|
425 There are two files: the basic word list and an affix file. The affixes are
|
|
426 used to modify the basic words to get the full word list. This significantly
|
|
427 reduces the number of words, especially for a language like Polish. This is
|
|
428 called affix compression.
|
221
|
429
|
237
|
430 The format for the affix and word list files is mostly identical to what
|
|
431 Myspell uses (the spell checker of Mozilla and OpenOffice.org). A description
|
|
432 can be found here:
|
|
433 http://lingucomponent.openoffice.org/affix.readme ~
|
|
434 Note that affixes are case sensitive, this isn't obvious from the description.
|
314
|
435
|
237
|
436 Vim supports a few extras. Hopefully Myspell will support these too some day.
|
|
437 See |spell-affix-vim|.
|
|
438
|
|
439 The basic word list and the affix file are combined and turned into a binary
|
|
440 spell file. All the preprocessing has been done, thus this file loads fast.
|
|
441 The binary spell file format is described in the source code (src/spell.c).
|
|
442 But only developers need to know about it.
|
221
|
443
|
237
|
444 The preprocessing also allows us to take the Myspell language files and modify
|
|
445 them before the Vim word list is made. The tools for this can be found in the
|
|
446 "src/spell" directory.
|
|
447
|
|
448
|
320
|
449 WORD LIST FORMAT *spell-dic-format*
|
237
|
450
|
|
451 A very short example, with line numbers:
|
221
|
452
|
237
|
453 1 1234
|
|
454 2 aan
|
|
455 3 Als
|
|
456 4 Etten-Leur
|
|
457 5 et al.
|
|
458 6 's-Gravenhage
|
|
459 7 's-Gravenhaags
|
|
460 8 bedel/P
|
|
461 9 kado/1
|
|
462 10 cadeau/2
|
|
463
|
314
|
464 The first line contains the number of words. Vim ignores it, but you do get
|
|
465 an error message if it's not there. *E760*
|
221
|
466
|
314
|
467 What follows is one word per line. There should be no white space before or
|
|
468 after the word.
|
237
|
469
|
|
470 When the word only has lower-case letters it will also match with the word
|
|
471 starting with an upper-case letter.
|
|
472
|
|
473 When the word includes an upper-case letter, this means the upper-case letter
|
|
474 is required at this position. The same word with a lower-case letter at this
|
|
475 position will not match. When some of the other letters are upper-case it will
|
|
476 not match either.
|
|
477
|
|
478 The same word with all upper-case characters will always be OK.
|
221
|
479
|
237
|
480 word list matches does not match ~
|
|
481 als als Als ALS ALs AlS aLs aLS
|
|
482 Als Als ALS als ALs AlS aLs aLS
|
|
483 ALS ALS als Als ALs AlS aLs aLS
|
|
484 AlS AlS ALS als Als ALs aLs aLS
|
221
|
485
|
314
|
486 The KEP affix ID can be used to specifically match a word with identical case
|
336
|
487 only, see below |spell-affix-KEP|.
|
308
|
488
|
237
|
489 Note in line 5 to 7 that non-word characters are used. You can include
|
|
490 any character in a word. When checking the text a word still only matches
|
|
491 when it appears with a non-word character before and after it. For Myspell a
|
|
492 word starting with a non-word character probably won't work.
|
|
493
|
|
494 After the word there is an optional slash and flags. Most of these flags are
|
|
495 letters that indicate the affixes that can be used with this word.
|
221
|
496
|
237
|
497 *spell-affix-vim*
|
314
|
498 A flag that Vim adds and is not in Myspell is the flag defined with KEP in the
|
308
|
499 affix file. This has the meaning that case matters. This can be used if the
|
|
500 word does not have the first letter in upper case at the start of a sentence.
|
314
|
501 Example (assuming that = was used for KEP):
|
237
|
502
|
|
503 word list matches does not match ~
|
|
504 's morgens/= 's morgens 'S morgens 's Morgens
|
|
505 's Morgens 's Morgens 'S morgens 's morgens
|
221
|
506
|
237
|
507 *spell-affix-mbyte*
|
|
508 The basic word list is normally in an 8-bit encoding, which is mentioned in
|
|
509 the affix file. The affix file must always be in the same encoding as the
|
|
510 word list. This is compatible with Myspell. For Vim the encoding may also be
|
|
511 something else, any encoding that "iconv" supports. The "SET" line must
|
|
512 specify the name of the encoding. When using a multi-byte encoding it's
|
|
513 possible to use more different affixes.
|
221
|
514
|
341
|
515
|
|
516 CHARACTER TABLES
|
258
|
517 *spell-affix-chars*
|
314
|
518 When using an 8-bit encoding the affix file should define what characters are
|
|
519 word characters (as specified with ENC). This is because the system where
|
|
520 ":mkspell" is used may not support a locale with this encoding and isalpha()
|
|
521 won't work. For example when using "cp1250" on Unix.
|
258
|
522
|
336
|
523 *E761* *E762* *spell-affix-FOL*
|
|
524 *spell-affix-LOW* *spell-affix-UPP*
|
258
|
525 Three lines in the affix file are needed. Simplistic example:
|
|
526
|
341
|
527 FOL áëñ ~
|
|
528 LOW áëñ ~
|
|
529 UPP ÁËÑ ~
|
258
|
530
|
|
531 All three lines must have exactly the same number of characters.
|
|
532
|
|
533 The "FOL" line specifies the case-folded characters. These are used to
|
|
534 compare words while ignoring case. For most encodings this is identical to
|
|
535 the lower case line.
|
|
536
|
|
537 The "LOW" line specifies the characters in lower-case. Mostly it's equal to
|
|
538 the "FOL" line.
|
|
539
|
|
540 The "UPP" line specifies the characters with upper-case. That is, a character
|
|
541 is upper-case where it's different from the character at the same position in
|
|
542 "FOL".
|
|
543
|
|
544 ASCII characters should be omitted, Vim always handles these in the same way.
|
|
545 When the encoding is UTF-8 no word characters need to be specified.
|
|
546
|
|
547 *E763*
|
353
|
548 Vim allows you to use spell checking for several languages in the same file.
|
|
549 You can list them in the 'spelllang' option. As a consequence all spell files
|
|
550 for the same encoding must use the same word characters, otherwise they can't
|
|
551 be combined without errors. If you get a warning that the word tables differ
|
|
552 you may need to generate the .spl file again with |:mkspell|. Check the FOL,
|
|
553 LOW and UPP lines in the used .aff file.
|
|
554
|
|
555 The XX.ascii.spl spell file generated with the "-ascii" argument will not
|
|
556 contain the table with characters, so that it can be combine with spell files
|
|
557 for any encoding. The .add.spl files also do not contain the table.
|
258
|
558
|
341
|
559
|
|
560 AFFIXES
|
336
|
561 *spell-affix-PFX* *spell-affix-SFX*
|
341
|
562 The usual PFX (prefix) and SFX (suffix) lines are supported (see the Myspell
|
|
563 documentation). Note that Myspell ignores any extra text after the relevant
|
|
564 info. Vim requires this text to start with a "#" so that mistakes don't go
|
|
565 unnoticed. Example:
|
|
566
|
|
567 SFX F 0 in [^i]n # Spion > Spionin ~
|
336
|
568
|
341
|
569 *spell-affix-PFXPOSTPONE*
|
|
570 When an affix file has very many prefixes that apply to many words it's not
|
|
571 possible to build the whole word list in memory. This applies to Hebrew (a
|
|
572 list with all words is over a Gbyte). In that case applying prefixes must be
|
|
573 postponed. This makes spell checking slower. It is indicated by this keyword
|
|
574 in the .aff file:
|
|
575
|
|
576 PFXPOSTPONE ~
|
|
577
|
|
578 Only prefixes without a chop string can be postponed, prefixes with a chop
|
|
579 string will still be included in the word list.
|
|
580
|
|
581
|
|
582 KEEP-CASE WORDS
|
314
|
583 *spell-affix-KEP*
|
|
584 In the affix file a KEP line can be used to define the affix name used for
|
308
|
585 keep-case words. Example:
|
|
586
|
314
|
587 KEP = ~
|
308
|
588
|
|
589 See above for an example |spell-affix-vim|.
|
|
590
|
341
|
591
|
|
592 RARE WORDS
|
314
|
593 *spell-affix-RAR*
|
308
|
594 In the affix file a RAR line can be used to define the affix name used for
|
|
595 rare words. Example:
|
|
596
|
|
597 RAR ? ~
|
|
598
|
|
599 Rare words are highlighted differently from bad words. This is to be used for
|
|
600 words that are correct for the language, but are hardly ever used and could be
|
348
|
601 a typing mistake anyway. When the same word is found as good it won't be
|
|
602 highlighted as rare.
|
|
603
|
|
604
|
|
605 BAD WORDS
|
|
606 *spell-affix-BAD*
|
|
607 In the affix file a BAD line can be used to define the affix name used for
|
|
608 bad words. Example:
|
|
609
|
|
610 BAD ! ~
|
|
611
|
|
612 This can be used to exclude words that would otherwise be good. For example
|
|
613 "the the". Once a word has been marked as bad it won't be undone by
|
|
614 encountering the same word as good.
|
308
|
615
|
|
616
|
323
|
617 REPLACEMENTS *spell-affix-REP*
|
|
618
|
|
619 In the affix file REP items can be used to define common mistakes. This is
|
|
620 used to make spelling suggestions. The items define the "from" text and the
|
|
621 "to" replacement. Example:
|
|
622
|
|
623 REP 4 ~
|
|
624 REP f ph ~
|
|
625 REP ph f ~
|
|
626 REP k ch ~
|
|
627 REP ch k ~
|
|
628
|
|
629 The first line specifies the number of REP lines following. Vim ignores it.
|
|
630
|
|
631
|
|
632 SIMILAR CHARACTERS *spell-affix-MAP*
|
|
633
|
|
634 In the affix file MAP items can be used to define letters that very much
|
|
635 alike. This is mostly used for a letter with different accents. This is used
|
|
636 to prefer suggestions with these letters substituted. Example:
|
|
637
|
|
638 MAP 2 ~
|
|
639 MAP eéëêè ~
|
|
640 MAP uüùúû ~
|
|
641
|
|
642 The first line specifies the number of MAP lines following. Vim ignores it.
|
|
643
|
336
|
644 A letter must only appear in one of the MAP items. It's a bit more efficient
|
|
645 if the first letter is ASCII or at least one without accents.
|
|
646
|
323
|
647
|
|
648 SOUNDS-A-LIKE *spell-affix-SAL*
|
|
649
|
|
650 In the affix file SAL items can be used to define the sounds-a-like mechanism
|
|
651 to be used. The main items define the "from" text and the "to" replacement.
|
|
652 Example:
|
|
653
|
|
654 SAL CIA X ~
|
|
655 SAL CH X ~
|
|
656 SAL C K ~
|
|
657 SAL K K ~
|
|
658
|
|
659 TODO: explain how it works.
|
|
660
|
|
661 There are a few special items:
|
|
662
|
|
663 SAL followup true ~
|
|
664 SAL collapse_result true ~
|
|
665 SAL remove_accents true ~
|
|
666
|
|
667 "1" has the same meaning as "true". Any other value means "false".
|
|
668
|
221
|
669 vim:tw=78:sw=4:ts=8:ft=help:norl:
|