blob: d76c66b80698f7273952e1ae07b2ada22a62b175 [file] [log] [blame]
Bram Moolenaar488c6512005-08-11 20:09:58 +00001*spell.txt* For Vim version 7.0aa. Last change: 2005 Aug 11
Bram Moolenaar217ad922005-03-20 22:37:15 +00002
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
7Spell checking *spell*
8
91. Quick start |spell-quickstart|
Bram Moolenaard042c562005-06-30 22:04:15 +0000102. Remarks on spell checking |spell-remarks|
113. Generating a spell file |spell-mkspell|
124. Spell file format |spell-file-format|
Bram Moolenaar217ad922005-03-20 22:37:15 +000013
14{Vi does not have any of these commands}
15
16Spell checking is not available when the |+syntax| feature has been disabled
17at compile time.
18
19==============================================================================
201. Quick start *spell-quickstart*
21
22This command switches on spell checking: >
23
24 :setlocal spell spelllang=en_us
25
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000026This switches on the 'spell' option and specifies to check for US English.
Bram Moolenaar217ad922005-03-20 22:37:15 +000027
28The words that are not recognized are highlighted with one of these:
Bram Moolenaar520470a2005-06-16 21:59:56 +000029 SpellBad word not recognized |hl-SpellBad|
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +000030 SpellCap word not capitalised |hl-SpellCap|
Bram Moolenaar520470a2005-06-16 21:59:56 +000031 SpellRare rare word |hl-SpellRare|
32 SpellLocal wrong spelling for selected region |hl-SpellLocal|
Bram Moolenaar217ad922005-03-20 22:37:15 +000033
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000034Vim only checks words for spelling, there is no grammar check.
35
Bram Moolenaar45360022005-07-21 21:08:21 +000036If the 'mousemodel' option is set to "popup" and the cursor is on a badly
37spelled word or it is "popup_setpos" and the mouse pointer is on a badly
38spelled word, then the popup menu will contain an submenu to replace the bad
39word. Note: this slows down the appearance of the popup menu.
40
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000041To search for the next misspelled word:
42
43 *]s* *E756*
44]s Move to next misspelled word after the cursor.
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +000045 A count before the command can be used to repeat.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000046
47 *[s*
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +000048[s Like "]s" but search backwards, find the misspelled
Bram Moolenaar30abd282005-06-22 22:35:10 +000049 word before the cursor. Doesn't recognize words
50 split over two lines, thus may stop at words that are
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000051 not highlighted as bad. Does not stop at word with
52 missing capital at the start of a line.
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +000053
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.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000060
Bram Moolenaar217ad922005-03-20 22:37:15 +000061
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +000062To add words to your own word list: *E764*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000063
64 *zg*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000065zg 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.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000073
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000074 *zG*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000075zG Like "zg" but add the word to the internal word list
76 |internal-wordlist|.
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000077
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000078 *zw*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000079zw Like "zg" but mark the word as a wrong (bad) word.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000080
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000081 *zW*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000082zW Like "zw" but add the word to the internal word list
83 |internal-wordlist|.
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000084
Bram Moolenaar520470a2005-06-16 21:59:56 +000085 *:spe* *:spellgood*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000086:[count]spe[llgood] {word}
Bram Moolenaar53180ce2005-07-05 21:48:14 +000087 Add {word} as a good word to 'spellfile', like with
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000088 "zg". Without count the first name is used, with a
89 count of two the second entry, etc.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000090
Bram Moolenaar53180ce2005-07-05 21:48:14 +000091:spe[llgood]! {word} Add {word} as a good word to the internal word list,
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000092 like with "zG".
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +000093
Bram Moolenaar520470a2005-06-16 21:59:56 +000094 *:spellw* *:spellwrong*
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000095:[count]spellw[rong] {word}
Bram Moolenaar53180ce2005-07-05 21:48:14 +000096 Add {word} as a wrong (bad) word to 'spellfile', as
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +000097 with "zw". Without count the first name is used, with
98 a count of two the second entry, etc.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +000099
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000100:spellw[rong]! {word} Add {word} as a wrong (bad) word to the internal word
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000101 list.
102
Bram Moolenaarf461c8e2005-06-25 23:04:51 +0000103After adding a word to 'spellfile' with the above commands its associated
Bram Moolenaard042c562005-06-30 22:04:15 +0000104".spl" file will automatically be updated and reloaded. If you change
105'spellfile' manually you need to use the |:mkspell| command. This sequence of
106commands mostly works well: >
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000107 :edit <file in 'spellfile'>
Bram Moolenaarf461c8e2005-06-25 23:04:51 +0000108< (make changes to the spell file) >
109 :mkspell! %
110
111More details about the 'spellfile' format below |spell-wordlist-format|.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000112
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000113 *internal-wordlist*
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000114The internal word list is used for all buffers where 'spell' is set. It is
115not stored, it is lost when you exit Vim. It is also cleared when 'encoding'
116is set.
117
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000118
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000119Finding suggestions for bad words:
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000120 *z?*
Bram Moolenaar30abd282005-06-22 22:35:10 +0000121z? For the word under/after the cursor suggest correctly
Bram Moolenaard042c562005-06-30 22:04:15 +0000122 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.
Bram Moolenaar30abd282005-06-22 22:35:10 +0000125 The results are sorted on similarity to the word
126 under/after the cursor.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000127 This may take a long time. Hit CTRL-C when you are
128 bored.
Bram Moolenaar24bbcfe2005-06-28 23:32:02 +0000129 This does not work when there is a line break halfway
130 a bad word (e.g., "the the").
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000131 You can enter the number of your choice or press
Bram Moolenaar24bbcfe2005-06-28 23:32:02 +0000132 <Enter> if you don't want to replace. You can also
133 use the mouse to click on your choice (only works if
134 the mouse can be used in Normal mode and when there
Bram Moolenaard042c562005-06-30 22:04:15 +0000135 are no line wraps). Click on the first (header) line
Bram Moolenaar24bbcfe2005-06-28 23:32:02 +0000136 to cancel.
Bram Moolenaarf3bd51a2005-06-14 22:11:18 +0000137 If 'verbose' is non-zero a score will be displayed to
138 indicate the likeliness to the badly spelled word (the
139 higher the score the more different).
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000140 When a word was replaced the redo command "." will
141 repeat the word replacement. This works like "ciw",
142 the good word and <Esc>.
143
Bram Moolenaar24bbcfe2005-06-28 23:32:02 +0000144 *:spellr* *:spellrepall* *E752* *E753*
145:spellr[epall] Repeat the replacement done by |z?| for all matches
146 with the replaced word in the current window.
147
Bram Moolenaar488c6512005-08-11 20:09:58 +0000148In Insert mode, when the cursor is after a badly spelled word, you can use
149CTRL-X s to find suggestions. This works like Insert mode completion. Use
150CTRL-N to use the next suggestion, CTRL-P to go back. |i_CTRL-X_s|
151
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000152The 'spellsuggest' option influences how the list of suggestions is generated
153and sorted. See |'spellsuggest'|.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000154
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000155The 'spellcapcheck' option is used to check the first word of a sentence
156starts with a capital. This doesn't work for the first word in the file.
157When there is a line break right after a sentence the highlighting of the next
158line may be postponed. Use |CTRL-L| when needed.
159
Bram Moolenaard042c562005-06-30 22:04:15 +0000160==============================================================================
1612. Remarks on spell checking *spell-remarks*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000162
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000163PERFORMANCE
164
Bram Moolenaard042c562005-06-30 22:04:15 +0000165Vim does on-the-fly spell checking. To make this work fast the word list is
166loaded in memory. Thus this uses a lot of memory (1 Mbyte or more). There
167might also be a noticeable delay when the word list is loaded, which happens
168when 'spell' is set and when 'spelllang' is set while 'spell' was already set.
169To minimize the delay each word list is only loaded once, it is not deleted
170when 'spelllang' is made empty or 'spell' is reset. When 'encoding' is set
171all the word lists are reloaded, thus you may notice a delay then too.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000172
173
Bram Moolenaar217ad922005-03-20 22:37:15 +0000174REGIONS
175
176A word may be spelled differently in various regions. For example, English
177comes in (at least) these variants:
178
179 en all regions
Bram Moolenaar5c5474b2005-04-19 21:40:26 +0000180 en_au Australia
Bram Moolenaar217ad922005-03-20 22:37:15 +0000181 en_ca Canada
Bram Moolenaar5c5474b2005-04-19 21:40:26 +0000182 en_gb Great Britain
183 en_nz New Zealand
184 en_us USA
Bram Moolenaar217ad922005-03-20 22:37:15 +0000185
186Words that are not used in one region but are used in another region are
Bram Moolenaar520470a2005-06-16 21:59:56 +0000187highlighted with SpellLocal |hl-SpellLocal|.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000188
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000189Always use lowercase letters for the language and region names.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000190
Bram Moolenaar3638c682005-06-08 22:05:14 +0000191When adding a word with |zg| or another command it's always added for all
192regions. You can change that by manually editing the 'spellfile'. See
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000193|spell-wordlist-format|. Note that the regions as specified in the files in
194'spellfile' are only used when all entries in "spelllang" specify the same
195region (not counting files specified by their .spl name).
Bram Moolenaar3638c682005-06-08 22:05:14 +0000196
Bram Moolenaar217ad922005-03-20 22:37:15 +0000197
Bram Moolenaar3b506942005-06-23 22:36:45 +0000198SPELL FILES *spell-load*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000199
200Vim searches for spell files in the "spell" subdirectory of the directories in
Bram Moolenaar3638c682005-06-08 22:05:14 +0000201'runtimepath'. The name is: LL.EEE.spl, where:
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000202 LL the language name
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000203 EEE the value of 'encoding'
Bram Moolenaar217ad922005-03-20 22:37:15 +0000204
Bram Moolenaar3b506942005-06-23 22:36:45 +0000205The value for "LL" comes from 'spelllang', but excludes the region name.
206Examples:
207 'spelllang' LL ~
208 en_us en
209 en-rare en-rare
210 medical_ca medical
211
Bram Moolenaar3638c682005-06-08 22:05:14 +0000212Only the first file is loaded, the one that is first in 'runtimepath'. If
213this succeeds then additionally files with the name LL.EEE.add.spl are loaded.
214All the ones that are found are used.
215
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000216Additionally, the files related to the names in 'spellfile' are loaded. These
217are the files that |zg| and |zw| add good and wrong words to.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000218
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000219Exceptions:
220- Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign doesn't
221 matter for spelling.
222- When no spell file for 'encoding' is found "ascii" is tried. This only
223 works for languages where nearly all words are ASCII, such as English. It
224 helps when 'encoding' is not "latin1", such as iso-8859-2, and English text
Bram Moolenaar3638c682005-06-08 22:05:14 +0000225 is being edited. For the ".add" files the same name as the found main
226 spell file is used.
227
228For example, with these values:
229 'runtimepath' is "~/.vim,/usr/share/vim70,~/.vim/after"
230 'encoding' is "iso-8859-2"
231 'spelllang' is "pl"
232
233Vim will look for:
2341. ~/.vim/spell/pl.iso-8859-2.spl
2352. /usr/share/vim70/spell/pl.iso-8859-2.spl
2363. ~/.vim/spell/pl.iso-8859-2.add.spl
2374. /usr/share/vim70/spell/pl.iso-8859-2.add.spl
2385. ~/.vim/after/spell/pl.iso-8859-2.add.spl
239
240This assumes 1. is not found and 2. is found.
241
242If 'encoding' is "latin1" Vim will look for:
2431. ~/.vim/spell/pl.latin1.spl
2442. /usr/share/vim70/spell/pl.latin1.spl
2453. ~/.vim/after/spell/pl.latin1.spl
2464. ~/.vim/spell/pl.ascii.spl
2475. /usr/share/vim70/spell/pl.ascii.spl
2486. ~/.vim/after/spell/pl.ascii.spl
249
250This assumes none of them are found (Polish doesn't make sense when leaving
251out the non-ASCII characters).
Bram Moolenaar217ad922005-03-20 22:37:15 +0000252
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000253Spelling for EBCDIC is currently not supported.
254
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000255A spell file might not be available in the current 'encoding'. See
256|spell-mkspell| about how to create a spell file. Converting a spell file
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000257with "iconv" will NOT work!
Bram Moolenaar217ad922005-03-20 22:37:15 +0000258
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000259 *E758* *E759*
260When loading a spell file Vim checks that it is properly formatted. If you
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000261get an error the file may be truncated, modified or intended for another Vim
262version.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000263
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000264
265WORDS
266
267Vim uses a fixed method to recognize a word. This is independent of
268'iskeyword', so that it also works in help files and for languages that
269include characters like '-' in 'iskeyword'. The word characters do depend on
270'encoding'.
271
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000272The table with word characters is stored in the main .spl file. Therefore it
273matters what the current locale is when generating it! A .add.spl file does
Bram Moolenaarf461c8e2005-06-25 23:04:51 +0000274not contain a word table though.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000275
Bram Moolenaar3638c682005-06-08 22:05:14 +0000276A word that starts with a digit is always ignored. That includes hex numbers
277in the form 0xff and 0XFF.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000278
279
Bram Moolenaar30abd282005-06-22 22:35:10 +0000280WORD COMBINATIONS
281
282It is possible to spell-check words that include a space. This is used to
283recognize words that are invalid when used by themselves, e.g. for "et al.".
284It can also be used to recognize "the the" and highlight it.
285
286The number of spaces is irrelevant. In most cases a line break may also
287appear. However, this makes it difficult to find out where to start checking
288for spelling mistakes. When you make a change to one line and only that line
289is redrawn Vim won't look in the previous line, thus when "et" is at the end
290of the previous line "al." will be flagged as an error. And when you type
291"the<CR>the" the highlighting doesn't appear until the first line is redrawn.
292Use |CTRL-L| to redraw right away. "[s" will also stop at a word combination
293with a line break.
294
295When encountering a line break Vim skips characters such as '*', '>' and '"',
296so that comments in C, shell and Vim code can be spell checked.
297
298
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +0000299SYNTAX HIGHLIGHTING *spell-syntax*
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000300
301Files that use syntax highlighting can specify where spell checking should be
302done:
303
Bram Moolenaar3638c682005-06-08 22:05:14 +00003041. everywhere default
3052. in specific items use "contains=@Spell"
3063. everywhere but specific items use "contains=@NoSpell"
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000307
Bram Moolenaar3638c682005-06-08 22:05:14 +0000308For the second method adding the @NoSpell cluster will disable spell checking
309again. This can be used, for example, to add @Spell to the comments of a
310program, and add @NoSpell for items that shouldn't be checked.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000311
Bram Moolenaar30abd282005-06-22 22:35:10 +0000312
313VIM SCRIPTS
314
315If you want to write a Vim script that does something with spelling, you may
316find these functions useful:
317
318 spellbadword() find badly spelled word at the cursor
319 spellsuggest() get list of spelling suggestions
Bram Moolenaard042c562005-06-30 22:04:15 +0000320 soundfold() get the sound-a-like version of a word
Bram Moolenaar30abd282005-06-22 22:35:10 +0000321
Bram Moolenaar217ad922005-03-20 22:37:15 +0000322==============================================================================
Bram Moolenaard042c562005-06-30 22:04:15 +00003233. Generating a spell file *spell-mkspell*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000324
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000325Vim uses a binary file format for spelling. This greatly speeds up loading
326the word list and keeps it small.
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000327 *.aff* *.dic* *Myspell*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000328You can create a Vim spell file from the .aff and .dic files that Myspell
329uses. Myspell is used by OpenOffice.org and Mozilla. You should be able to
330find them here:
331 http://lingucomponent.openoffice.org/spell_dic.html
Bram Moolenaar30abd282005-06-22 22:35:10 +0000332You can also use a plain word list. The results are the same, the choice
Bram Moolenaard042c562005-06-30 22:04:15 +0000333depends on what word lists you can find.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000334
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000335If you install Aap (from www.a-a-p.org) you can use the recipes in the
336runtime/spell/??/ directories. Aap will take care of downloading the files,
337apply patches needed for Vim and build the .spl file.
338
Bram Moolenaare13305e2005-06-19 22:54:15 +0000339Make sure your current locale is set properly, otherwise Vim doesn't know what
340characters are upper/lower case letters. If the locale isn't available (e.g.,
341when using an MS-Windows codepage on Unix) add tables to the .aff file
Bram Moolenaar3b506942005-06-23 22:36:45 +0000342|spell-affix-chars|. If the .aff file doesn't define a table then the word
343table of the currently active spelling is used. If spelling is not active
344then Vim will try to guess.
Bram Moolenaare13305e2005-06-19 22:54:15 +0000345
Bram Moolenaar3b506942005-06-23 22:36:45 +0000346 *:mksp* *:mkspell*
347:mksp[ell][!] [-ascii] {outname} {inname} ...
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000348 Generate a Vim spell file word lists. Example: >
Bram Moolenaard042c562005-06-30 22:04:15 +0000349 :mkspell /tmp/nl nl_NL.words
Bram Moolenaar3b506942005-06-23 22:36:45 +0000350< *E751*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000351 When {outname} ends in ".spl" it is used as the output
352 file name. Otherwise it should be a language name,
Bram Moolenaar3b506942005-06-23 22:36:45 +0000353 such as "en", without the region name. The file
354 written will be "{outname}.{encoding}.spl", where
355 {encoding} is the value of the 'encoding' option.
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000356
Bram Moolenaard042c562005-06-30 22:04:15 +0000357 When the output file already exists [!] must be used
Bram Moolenaar520470a2005-06-16 21:59:56 +0000358 to overwrite it.
359
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000360 When the [-ascii] argument is present, words with
361 non-ascii characters are skipped. The resulting file
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000362 ends in "ascii.spl".
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000363
364 The input can be the Myspell format files {inname}.aff
365 and {inname}.dic. If {inname}.aff does not exist then
366 {inname} is used as the file name of a plain word
367 list.
368
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000369 Multiple {inname} arguments can be given to combine
370 regions into one Vim spell file. Example: >
371 :mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU
372< This combines the English word lists for US, CA and AU
373 into one en.spl file.
374 Up to eight regions can be combined. *E754* *755*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000375 The REP and SAL items of the first .aff file where
376 they appear are used. |spell-affix-REP|
377 |spell-affix-SAL|
Bram Moolenaar217ad922005-03-20 22:37:15 +0000378
Bram Moolenaar30abd282005-06-22 22:35:10 +0000379 This command uses a lot of memory, required to find
380 the optimal word tree (Polish requires a few hundred
381 Mbyte). The final result will be much smaller.
382
Bram Moolenaard042c562005-06-30 22:04:15 +0000383 After the spell file was written and it was being used
384 in a buffer it will be reloaded automatically.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000385
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000386:mksp[ell] [-ascii] {name}.{enc}.add
387 Like ":mkspell" above, using {name}.{enc}.add as the
Bram Moolenaard042c562005-06-30 22:04:15 +0000388 input file and producing an output file in the same
389 directory that has ".spl" appended.
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000390
391:mksp[ell] [-ascii] {name}
392 Like ":mkspell" above, using {name} as the input file
Bram Moolenaard042c562005-06-30 22:04:15 +0000393 and producing an output file in the same directory
394 that has ".{enc}.spl" appended.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000395
396Since you might want to change a Myspell word list for use with Vim the
397following procedure is recommended:
Bram Moolenaar217ad922005-03-20 22:37:15 +0000398
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +00003991. Obtain the xx_YY.aff and xx_YY.dic files from Myspell.
4002. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic.
4013. Change the xx_YY.aff and xx_YY.dic files to remove bad words, add missing
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000402 words, define word characters with FOL/LOW/UPP, etc. The distributed
403 "src/spell/*.diff" files can be used.
Bram Moolenaard042c562005-06-30 22:04:15 +00004044. Start Vim with the right locale and use |:mkspell| to generate the Vim
405 spell file.
4065. Try out the spell file with ":set spell spelllang=xx" if you wrote it in
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000407 a spell directory in 'runtimepath', or ":set spelllang=xx.enc.spl" if you
Bram Moolenaard042c562005-06-30 22:04:15 +0000408 wrote it somewhere else.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000409
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000410When the Myspell files are updated you can merge the differences:
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00004111. Obtain the new Myspell files as xx_YY.new.aff and xx_UU.new.dic.
4122. Use Vimdiff to see what changed: >
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000413 vimdiff xx_YY.orig.dic xx_YY.new.dic
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00004143. Take over the changes you like in xx_YY.dic.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000415 You may also need to change xx_YY.aff.
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00004164. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.new.aff.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000417
Bram Moolenaar3b506942005-06-23 22:36:45 +0000418
419SPELL FILE DUMP
420
421If for some reason you want to check what words are supported by the currently
422used spelling files, use this command:
423
424 *:spelldump* *:spelld*
425:spelld[ump] Open a new window and fill it with all currently valid
426 words.
Bram Moolenaard042c562005-06-30 22:04:15 +0000427 Note: For some languages the result may be enormous,
428 causing Vim to run out of memory.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000429
430The format of the word list is used |spell-wordlist-format|. You should be
431able to read it with ":mkspell" to generate one .spl file that includes all
432the words.
433
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000434When all entries to 'spelllang' use the same regions or no regions at all then
435the region information is included in the dumped words. Otherwise only words
436for the current region are included and no "/regions" line is generated.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000437
Bram Moolenaard042c562005-06-30 22:04:15 +0000438Comment lines with the name of the .spl file are used as a header above the
439words that were generated from that .spl file.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000440
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000441==============================================================================
Bram Moolenaard042c562005-06-30 22:04:15 +00004424. Spell file format *spell-file-format*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000443
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000444This is the format of the files that are used by the person who creates and
445maintains a word list.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000446
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000447Note that we avoid the word "dictionary" here. That is because the goal of
448spell checking differs from writing a dictionary (as in the book). For
Bram Moolenaard042c562005-06-30 22:04:15 +0000449spelling we need a list of words that are OK, thus should not to be
450highlighted. Person and company names will not appear in a dictionary, but do
451appear in a word list. And some old words are rarely used while they are
452common misspellings. These do appear in a dictionary but not in a word list.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000453
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000454There are two formats: A straight list of words and a list using affix
Bram Moolenaard042c562005-06-30 22:04:15 +0000455compression. The files with affix compression are used by Myspell (Mozilla
456and OpenOffice.org). This requires two files, one with .aff and one with .dic
457extension.
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000458
459
Bram Moolenaard042c562005-06-30 22:04:15 +0000460FORMAT OF STRAIGHT WORD LIST *spell-wordlist-format*
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000461
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000462The words must appear one per line. That is all that is required.
Bram Moolenaard042c562005-06-30 22:04:15 +0000463
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000464Additionally the following items are recognized:
Bram Moolenaard042c562005-06-30 22:04:15 +0000465
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000466- Empty and blank lines are ignored.
Bram Moolenaard042c562005-06-30 22:04:15 +0000467
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000468- Lines starting with a # are ignored (comment lines).
Bram Moolenaard042c562005-06-30 22:04:15 +0000469
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000470- A line starting with "/encoding=", before any word, specifies the encoding
471 of the file. After the second '=' comes an encoding name. This tells Vim
Bram Moolenaard042c562005-06-30 22:04:15 +0000472 to setup conversion from the specified encoding to 'encoding'. Thus you can
473 use one word list for several target encodings.
474
Bram Moolenaar3638c682005-06-08 22:05:14 +0000475- A line starting with "/regions=" specifies the region names that are
476 supported. Each region name must be two ASCII letters. The first one is
477 region 1. Thus "/regions=usca" has region 1 "us" and region 2 "ca".
Bram Moolenaard042c562005-06-30 22:04:15 +0000478 In an addition word list the region names should be equal to the main word
479 list!
480
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000481- Other lines starting with '/' are reserved for future use. The ones that
482 are not recognized are ignored (but you do get a warning message).
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000483
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000484- A "/" may follow the word with the following items:
485 = Case must match exactly.
486 ? Rare word.
487 ! Bad (wrong) word.
488 digit A region in which the word is valid. If no regions are
489 specified the word is valid in all regions.
490
Bram Moolenaar3638c682005-06-08 22:05:14 +0000491Example:
492
493 # This is an example word list comment
494 /encoding=latin1 encoding of the file
495 /regions=uscagb regions "us", "ca" and "gb"
496 example word for all regions
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000497 blah/12 word for regions "us" and "ca"
498 vim/! bad word
499 Campbell/?3 rare word in region 3 "gb"
500 's mornings/= keep-case word
Bram Moolenaar3638c682005-06-08 22:05:14 +0000501
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000502Note that when "/=" is used the same word with all upper-case letters is not
503accepted. This is different from a word with mixed case that is automatically
504marked as keep-case, those words may appear in all upper-case letters.
505
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000506
507FORMAT WITH AFFIX COMPRESSION
508
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000509There are two files: the basic word list and an affix file. The affixes are
510used to modify the basic words to get the full word list. This significantly
511reduces the number of words, especially for a language like Polish. This is
512called affix compression.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000513
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000514The format for the affix and word list files is mostly identical to what
515Myspell uses (the spell checker of Mozilla and OpenOffice.org). A description
516can be found here:
517 http://lingucomponent.openoffice.org/affix.readme ~
518Note that affixes are case sensitive, this isn't obvious from the description.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000519
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000520Vim supports a few extras. Hopefully Myspell will support these too some day.
521See |spell-affix-vim|.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000522
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000523The basic word list and the affix file are combined and turned into a binary
524spell file. All the preprocessing has been done, thus this file loads fast.
525The binary spell file format is described in the source code (src/spell.c).
526But only developers need to know about it.
527
528The preprocessing also allows us to take the Myspell language files and modify
529them before the Vim word list is made. The tools for this can be found in the
530"src/spell" directory.
531
532
Bram Moolenaar3638c682005-06-08 22:05:14 +0000533WORD LIST FORMAT *spell-dic-format*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000534
535A very short example, with line numbers:
536
537 1 1234
538 2 aan
539 3 Als
540 4 Etten-Leur
541 5 et al.
542 6 's-Gravenhage
543 7 's-Gravenhaags
544 8 bedel/P
545 9 kado/1
546 10 cadeau/2
547
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000548The first line contains the number of words. Vim ignores it, but you do get
549an error message if it's not there. *E760*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000550
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000551What follows is one word per line. There should be no white space before or
552after the word.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000553
554When the word only has lower-case letters it will also match with the word
555starting with an upper-case letter.
556
557When the word includes an upper-case letter, this means the upper-case letter
558is required at this position. The same word with a lower-case letter at this
559position will not match. When some of the other letters are upper-case it will
560not match either.
561
Bram Moolenaard042c562005-06-30 22:04:15 +0000562The word with all upper-case characters will always be OK.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000563
564 word list matches does not match ~
565 als als Als ALS ALs AlS aLs aLS
566 Als Als ALS als ALs AlS aLs aLS
567 ALS ALS als Als ALs AlS aLs aLS
568 AlS AlS ALS als Als ALs aLs aLS
569
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000570The KEP affix ID can be used to specifically match a word with identical case
Bram Moolenaare7566042005-06-17 22:00:15 +0000571only, see below |spell-affix-KEP|.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000572
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000573Note in line 5 to 7 that non-word characters are used. You can include
574any character in a word. When checking the text a word still only matches
575when it appears with a non-word character before and after it. For Myspell a
576word starting with a non-word character probably won't work.
577
578After the word there is an optional slash and flags. Most of these flags are
Bram Moolenaard042c562005-06-30 22:04:15 +0000579letters that indicate the affixes that can be used with this word. These are
580specified with SFX and PFX lines in the .aff file. See the Myspell
581documentation.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000582
583 *spell-affix-vim*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000584A flag that Vim adds and is not in Myspell is the flag defined with KEP in the
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000585affix file. This has the meaning that case matters. This can be used if the
586word does not have the first letter in upper case at the start of a sentence.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000587Example (assuming that = was used for KEP):
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000588
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000589 word list matches does not match ~
590 's morgens/= 's morgens 'S morgens 's Morgens 'S MORGENS
591 's Morgens 's Morgens 'S MORGENS 'S morgens 's morgens
592
593The flag can also be used to avoid that the word matches when it is in all
594upper-case letters.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000595
596 *spell-affix-mbyte*
597The basic word list is normally in an 8-bit encoding, which is mentioned in
598the affix file. The affix file must always be in the same encoding as the
599word list. This is compatible with Myspell. For Vim the encoding may also be
600something else, any encoding that "iconv" supports. The "SET" line must
601specify the name of the encoding. When using a multi-byte encoding it's
Bram Moolenaard042c562005-06-30 22:04:15 +0000602possible to use more different affixes (but Myspell doesn't support that, thus
603you may not want to use it anyway).
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000604
Bram Moolenaare13305e2005-06-19 22:54:15 +0000605
606CHARACTER TABLES
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000607 *spell-affix-chars*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000608When using an 8-bit encoding the affix file should define what characters are
609word characters (as specified with ENC). This is because the system where
610":mkspell" is used may not support a locale with this encoding and isalpha()
611won't work. For example when using "cp1250" on Unix.
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000612
Bram Moolenaare7566042005-06-17 22:00:15 +0000613 *E761* *E762* *spell-affix-FOL*
614 *spell-affix-LOW* *spell-affix-UPP*
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000615Three lines in the affix file are needed. Simplistic example:
616
Bram Moolenaare13305e2005-06-19 22:54:15 +0000617 FOL áëñ ~
618 LOW áëñ ~
619 UPP ÁËÑ ~
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000620
621All three lines must have exactly the same number of characters.
622
623The "FOL" line specifies the case-folded characters. These are used to
624compare words while ignoring case. For most encodings this is identical to
625the lower case line.
626
627The "LOW" line specifies the characters in lower-case. Mostly it's equal to
628the "FOL" line.
629
630The "UPP" line specifies the characters with upper-case. That is, a character
631is upper-case where it's different from the character at the same position in
632"FOL".
633
634ASCII characters should be omitted, Vim always handles these in the same way.
635When the encoding is UTF-8 no word characters need to be specified.
636
637 *E763*
Bram Moolenaar3b506942005-06-23 22:36:45 +0000638Vim allows you to use spell checking for several languages in the same file.
639You can list them in the 'spelllang' option. As a consequence all spell files
640for the same encoding must use the same word characters, otherwise they can't
641be combined without errors. If you get a warning that the word tables differ
642you may need to generate the .spl file again with |:mkspell|. Check the FOL,
643LOW and UPP lines in the used .aff file.
644
645The XX.ascii.spl spell file generated with the "-ascii" argument will not
646contain the table with characters, so that it can be combine with spell files
647for any encoding. The .add.spl files also do not contain the table.
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000648
Bram Moolenaare7566042005-06-17 22:00:15 +0000649
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000650MID-WORD CHARACTERS
651 *spell-midword*
652Some characters are only to be considered word characters if they are used in
653between two ordinary word characters. An example is the single quote: It is
654often used to put text in quotes, thus it can't be recognized as a word
655character, but when it appears in between word characters it must be part of
656the word. This is needed to detect a spelling error such as they'are. That
657should be they're, but since "they" and "are" are words themselves that would
658go unnoticed.
659
660These characters are defined with MIDWORD in the .aff file:
661
662 MIDWORD '- ~
663
664
Bram Moolenaare13305e2005-06-19 22:54:15 +0000665AFFIXES
666 *spell-affix-PFX* *spell-affix-SFX*
667The usual PFX (prefix) and SFX (suffix) lines are supported (see the Myspell
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000668documentation or the Aspell manual:
669http://aspell.net/man-html/Affix-Compression.html).
Bram Moolenaare13305e2005-06-19 22:54:15 +0000670
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000671Note that Myspell ignores any extra text after the relevant info. Vim
672requires this text to start with a "#" so that mistakes don't go unnoticed.
673Example:
674
675 SFX F 0 in [^i]n # Spion > Spionin ~
676 SFX F 0 nen in # Bauerin > Bauerinnen ~
677
678An extra item for Vim is the "rare" flag. It must come after the other
679fields, before a comment. When used then all words that use the affix will be
680marked as rare words. Example:
681
682 PFX F 0 nene . rare ~
683 SFX F 0 oin n rare # hardly ever used ~
684
685However, if the word also appears as a good word in another way it won't be
686marked as rare.
Bram Moolenaare13305e2005-06-19 22:54:15 +0000687
688 *spell-affix-PFXPOSTPONE*
689When an affix file has very many prefixes that apply to many words it's not
690possible to build the whole word list in memory. This applies to Hebrew (a
691list with all words is over a Gbyte). In that case applying prefixes must be
692postponed. This makes spell checking slower. It is indicated by this keyword
693in the .aff file:
694
695 PFXPOSTPONE ~
696
697Only prefixes without a chop string can be postponed, prefixes with a chop
Bram Moolenaar78984f52005-08-01 07:19:10 +0000698string will still be included in the word list. An exception if the chop
699string is one character and equal to the last character of the added string,
700but in lower case. Thus when the chop string is used to allow the following
701word to start with an upper case letter.
Bram Moolenaare13305e2005-06-19 22:54:15 +0000702
703
704KEEP-CASE WORDS
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000705 *spell-affix-KEP*
706In the affix file a KEP line can be used to define the affix name used for
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000707keep-case words. Example:
708
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000709 KEP = ~
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000710
711See above for an example |spell-affix-vim|.
712
Bram Moolenaare13305e2005-06-19 22:54:15 +0000713
714RARE WORDS
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000715 *spell-affix-RAR*
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000716In the affix file a RAR line can be used to define the affix name used for
717rare words. Example:
718
719 RAR ? ~
720
721Rare words are highlighted differently from bad words. This is to be used for
722words that are correct for the language, but are hardly ever used and could be
Bram Moolenaar30abd282005-06-22 22:35:10 +0000723a typing mistake anyway. When the same word is found as good it won't be
724highlighted as rare.
725
726
727BAD WORDS
728 *spell-affix-BAD*
729In the affix file a BAD line can be used to define the affix name used for
730bad words. Example:
731
732 BAD ! ~
733
734This can be used to exclude words that would otherwise be good. For example
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000735"the the" in the .dic file:
736
737 the the/! ~
738
739Once a word has been marked as bad it won't be undone by encountering the same
740word as good.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000741
742
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000743REPLACEMENTS *spell-affix-REP*
744
745In the affix file REP items can be used to define common mistakes. This is
746used to make spelling suggestions. The items define the "from" text and the
747"to" replacement. Example:
748
749 REP 4 ~
750 REP f ph ~
751 REP ph f ~
752 REP k ch ~
753 REP ch k ~
754
755The first line specifies the number of REP lines following. Vim ignores it.
Bram Moolenaard042c562005-06-30 22:04:15 +0000756Don't include simple one-character replacements or swaps. Vim will try these
757anyway. You can include whole words if you want to, but you might want to use
758the "file:" item in 'spellsuggest' instead.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000759
760
761SIMILAR CHARACTERS *spell-affix-MAP*
762
Bram Moolenaard042c562005-06-30 22:04:15 +0000763In the affix file MAP items can be used to define letters that are very much
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000764alike. This is mostly used for a letter with different accents. This is used
765to prefer suggestions with these letters substituted. Example:
766
767 MAP 2 ~
768 MAP eéëêè ~
769 MAP uüùúû ~
770
771The first line specifies the number of MAP lines following. Vim ignores it.
772
Bram Moolenaard042c562005-06-30 22:04:15 +0000773Each letter must appear in only one of the MAP items. It's a bit more
774efficient if the first letter is ASCII or at least one without accents.
Bram Moolenaare7566042005-06-17 22:00:15 +0000775
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000776
Bram Moolenaard042c562005-06-30 22:04:15 +0000777SOUND-A-LIKE *spell-affix-SAL*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000778
779In the affix file SAL items can be used to define the sounds-a-like mechanism
780to be used. The main items define the "from" text and the "to" replacement.
Bram Moolenaard042c562005-06-30 22:04:15 +0000781Simplistic example:
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000782
783 SAL CIA X ~
784 SAL CH X ~
785 SAL C K ~
786 SAL K K ~
787
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000788There are a few rules and this can become quite complicated. An explanation
Bram Moolenaard042c562005-06-30 22:04:15 +0000789how it works can be found in the Aspell manual:
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000790http://aspell.net/man-html/Phonetic-Code.html.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000791
792There are a few special items:
793
794 SAL followup true ~
795 SAL collapse_result true ~
796 SAL remove_accents true ~
797
798"1" has the same meaning as "true". Any other value means "false".
799
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000800
801SIMPLE SOUNDFOLDING *spell-affix-SOFOFROM* *spell-affix-SOFOTO*
802
803The SAL mechanism is complex and slow. A simpler mechanism is mapping all
804characters to another character, mapping similar sounding characters to the
805same character. At the same time this does case folding. You can not have
Bram Moolenaard042c562005-06-30 22:04:15 +0000806both SAL items and simple soundfolding.
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000807
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000808There are two items required: one to specify the characters that are mapped
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000809and one that specifies the characters they are mapped to. They must have
810exactly the same number of characters. Example:
811
812 SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ~
813 SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkes ~
814
815In the example all vowels are mapped to the same character 'e'. Another
Bram Moolenaard042c562005-06-30 22:04:15 +0000816method would be to leave out all vowels. Some characters that sound nearly
817the same and are often mixed up, such as 'm' and 'n', are mapped to the same
818character. Don't do this too much, all words will start looking alike.
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000819
820Characters that do not appear in SOFOFROM will be left out, except that all
821white space is replaced by one space. Sequences of the same character in
822SOFOFROM are replaced by one.
823
824You can use the |soundfold()| function to try out the results. Or set the
825'verbose' option to see the score in the output of the |z?| command.
826
827
Bram Moolenaar217ad922005-03-20 22:37:15 +0000828 vim:tw=78:sw=4:ts=8:ft=help:norl: