blob: 573a9429d94968f32b97c0ba25b797a726f0ca3d [file] [log] [blame]
Bram Moolenaar78984f52005-08-01 07:19:10 +00001*spell.txt* For Vim version 7.0aa. Last change: 2005 Jul 31
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 Moolenaard857f0e2005-06-21 22:37:39 +0000148The 'spellsuggest' option influences how the list of suggestions is generated
149and sorted. See |'spellsuggest'|.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000150
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000151The 'spellcapcheck' option is used to check the first word of a sentence
152starts with a capital. This doesn't work for the first word in the file.
153When there is a line break right after a sentence the highlighting of the next
154line may be postponed. Use |CTRL-L| when needed.
155
Bram Moolenaard042c562005-06-30 22:04:15 +0000156==============================================================================
1572. Remarks on spell checking *spell-remarks*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000158
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000159PERFORMANCE
160
Bram Moolenaard042c562005-06-30 22:04:15 +0000161Vim does on-the-fly spell checking. To make this work fast the word list is
162loaded in memory. Thus this uses a lot of memory (1 Mbyte or more). There
163might also be a noticeable delay when the word list is loaded, which happens
164when 'spell' is set and when 'spelllang' is set while 'spell' was already set.
165To minimize the delay each word list is only loaded once, it is not deleted
166when 'spelllang' is made empty or 'spell' is reset. When 'encoding' is set
167all the word lists are reloaded, thus you may notice a delay then too.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000168
169
Bram Moolenaar217ad922005-03-20 22:37:15 +0000170REGIONS
171
172A word may be spelled differently in various regions. For example, English
173comes in (at least) these variants:
174
175 en all regions
Bram Moolenaar5c5474b2005-04-19 21:40:26 +0000176 en_au Australia
Bram Moolenaar217ad922005-03-20 22:37:15 +0000177 en_ca Canada
Bram Moolenaar5c5474b2005-04-19 21:40:26 +0000178 en_gb Great Britain
179 en_nz New Zealand
180 en_us USA
Bram Moolenaar217ad922005-03-20 22:37:15 +0000181
182Words that are not used in one region but are used in another region are
Bram Moolenaar520470a2005-06-16 21:59:56 +0000183highlighted with SpellLocal |hl-SpellLocal|.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000184
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000185Always use lowercase letters for the language and region names.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000186
Bram Moolenaar3638c682005-06-08 22:05:14 +0000187When adding a word with |zg| or another command it's always added for all
188regions. You can change that by manually editing the 'spellfile'. See
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000189|spell-wordlist-format|. Note that the regions as specified in the files in
190'spellfile' are only used when all entries in "spelllang" specify the same
191region (not counting files specified by their .spl name).
Bram Moolenaar3638c682005-06-08 22:05:14 +0000192
Bram Moolenaar217ad922005-03-20 22:37:15 +0000193
Bram Moolenaar3b506942005-06-23 22:36:45 +0000194SPELL FILES *spell-load*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000195
196Vim searches for spell files in the "spell" subdirectory of the directories in
Bram Moolenaar3638c682005-06-08 22:05:14 +0000197'runtimepath'. The name is: LL.EEE.spl, where:
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000198 LL the language name
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000199 EEE the value of 'encoding'
Bram Moolenaar217ad922005-03-20 22:37:15 +0000200
Bram Moolenaar3b506942005-06-23 22:36:45 +0000201The value for "LL" comes from 'spelllang', but excludes the region name.
202Examples:
203 'spelllang' LL ~
204 en_us en
205 en-rare en-rare
206 medical_ca medical
207
Bram Moolenaar3638c682005-06-08 22:05:14 +0000208Only the first file is loaded, the one that is first in 'runtimepath'. If
209this succeeds then additionally files with the name LL.EEE.add.spl are loaded.
210All the ones that are found are used.
211
Bram Moolenaar0d9c26d2005-07-02 23:19:16 +0000212Additionally, the files related to the names in 'spellfile' are loaded. These
213are the files that |zg| and |zw| add good and wrong words to.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000214
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000215Exceptions:
216- Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign doesn't
217 matter for spelling.
218- When no spell file for 'encoding' is found "ascii" is tried. This only
219 works for languages where nearly all words are ASCII, such as English. It
220 helps when 'encoding' is not "latin1", such as iso-8859-2, and English text
Bram Moolenaar3638c682005-06-08 22:05:14 +0000221 is being edited. For the ".add" files the same name as the found main
222 spell file is used.
223
224For example, with these values:
225 'runtimepath' is "~/.vim,/usr/share/vim70,~/.vim/after"
226 'encoding' is "iso-8859-2"
227 'spelllang' is "pl"
228
229Vim will look for:
2301. ~/.vim/spell/pl.iso-8859-2.spl
2312. /usr/share/vim70/spell/pl.iso-8859-2.spl
2323. ~/.vim/spell/pl.iso-8859-2.add.spl
2334. /usr/share/vim70/spell/pl.iso-8859-2.add.spl
2345. ~/.vim/after/spell/pl.iso-8859-2.add.spl
235
236This assumes 1. is not found and 2. is found.
237
238If 'encoding' is "latin1" Vim will look for:
2391. ~/.vim/spell/pl.latin1.spl
2402. /usr/share/vim70/spell/pl.latin1.spl
2413. ~/.vim/after/spell/pl.latin1.spl
2424. ~/.vim/spell/pl.ascii.spl
2435. /usr/share/vim70/spell/pl.ascii.spl
2446. ~/.vim/after/spell/pl.ascii.spl
245
246This assumes none of them are found (Polish doesn't make sense when leaving
247out the non-ASCII characters).
Bram Moolenaar217ad922005-03-20 22:37:15 +0000248
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000249Spelling for EBCDIC is currently not supported.
250
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000251A spell file might not be available in the current 'encoding'. See
252|spell-mkspell| about how to create a spell file. Converting a spell file
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000253with "iconv" will NOT work!
Bram Moolenaar217ad922005-03-20 22:37:15 +0000254
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000255 *E758* *E759*
256When loading a spell file Vim checks that it is properly formatted. If you
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000257get an error the file may be truncated, modified or intended for another Vim
258version.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000259
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000260
261WORDS
262
263Vim uses a fixed method to recognize a word. This is independent of
264'iskeyword', so that it also works in help files and for languages that
265include characters like '-' in 'iskeyword'. The word characters do depend on
266'encoding'.
267
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000268The table with word characters is stored in the main .spl file. Therefore it
269matters what the current locale is when generating it! A .add.spl file does
Bram Moolenaarf461c8e2005-06-25 23:04:51 +0000270not contain a word table though.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000271
Bram Moolenaar3638c682005-06-08 22:05:14 +0000272A word that starts with a digit is always ignored. That includes hex numbers
273in the form 0xff and 0XFF.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000274
275
Bram Moolenaar30abd282005-06-22 22:35:10 +0000276WORD COMBINATIONS
277
278It is possible to spell-check words that include a space. This is used to
279recognize words that are invalid when used by themselves, e.g. for "et al.".
280It can also be used to recognize "the the" and highlight it.
281
282The number of spaces is irrelevant. In most cases a line break may also
283appear. However, this makes it difficult to find out where to start checking
284for spelling mistakes. When you make a change to one line and only that line
285is redrawn Vim won't look in the previous line, thus when "et" is at the end
286of the previous line "al." will be flagged as an error. And when you type
287"the<CR>the" the highlighting doesn't appear until the first line is redrawn.
288Use |CTRL-L| to redraw right away. "[s" will also stop at a word combination
289with a line break.
290
291When encountering a line break Vim skips characters such as '*', '>' and '"',
292so that comments in C, shell and Vim code can be spell checked.
293
294
Bram Moolenaar9d0ec2e2005-04-20 19:45:58 +0000295SYNTAX HIGHLIGHTING *spell-syntax*
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000296
297Files that use syntax highlighting can specify where spell checking should be
298done:
299
Bram Moolenaar3638c682005-06-08 22:05:14 +00003001. everywhere default
3012. in specific items use "contains=@Spell"
3023. everywhere but specific items use "contains=@NoSpell"
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000303
Bram Moolenaar3638c682005-06-08 22:05:14 +0000304For the second method adding the @NoSpell cluster will disable spell checking
305again. This can be used, for example, to add @Spell to the comments of a
306program, and add @NoSpell for items that shouldn't be checked.
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000307
Bram Moolenaar30abd282005-06-22 22:35:10 +0000308
309VIM SCRIPTS
310
311If you want to write a Vim script that does something with spelling, you may
312find these functions useful:
313
314 spellbadword() find badly spelled word at the cursor
315 spellsuggest() get list of spelling suggestions
Bram Moolenaard042c562005-06-30 22:04:15 +0000316 soundfold() get the sound-a-like version of a word
Bram Moolenaar30abd282005-06-22 22:35:10 +0000317
Bram Moolenaar217ad922005-03-20 22:37:15 +0000318==============================================================================
Bram Moolenaard042c562005-06-30 22:04:15 +00003193. Generating a spell file *spell-mkspell*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000320
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000321Vim uses a binary file format for spelling. This greatly speeds up loading
322the word list and keeps it small.
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000323 *.aff* *.dic* *Myspell*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000324You can create a Vim spell file from the .aff and .dic files that Myspell
325uses. Myspell is used by OpenOffice.org and Mozilla. You should be able to
326find them here:
327 http://lingucomponent.openoffice.org/spell_dic.html
Bram Moolenaar30abd282005-06-22 22:35:10 +0000328You can also use a plain word list. The results are the same, the choice
Bram Moolenaard042c562005-06-30 22:04:15 +0000329depends on what word lists you can find.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000330
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000331If you install Aap (from www.a-a-p.org) you can use the recipes in the
332runtime/spell/??/ directories. Aap will take care of downloading the files,
333apply patches needed for Vim and build the .spl file.
334
Bram Moolenaare13305e2005-06-19 22:54:15 +0000335Make sure your current locale is set properly, otherwise Vim doesn't know what
336characters are upper/lower case letters. If the locale isn't available (e.g.,
337when using an MS-Windows codepage on Unix) add tables to the .aff file
Bram Moolenaar3b506942005-06-23 22:36:45 +0000338|spell-affix-chars|. If the .aff file doesn't define a table then the word
339table of the currently active spelling is used. If spelling is not active
340then Vim will try to guess.
Bram Moolenaare13305e2005-06-19 22:54:15 +0000341
Bram Moolenaar3b506942005-06-23 22:36:45 +0000342 *:mksp* *:mkspell*
343:mksp[ell][!] [-ascii] {outname} {inname} ...
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000344 Generate a Vim spell file word lists. Example: >
Bram Moolenaard042c562005-06-30 22:04:15 +0000345 :mkspell /tmp/nl nl_NL.words
Bram Moolenaar3b506942005-06-23 22:36:45 +0000346< *E751*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000347 When {outname} ends in ".spl" it is used as the output
348 file name. Otherwise it should be a language name,
Bram Moolenaar3b506942005-06-23 22:36:45 +0000349 such as "en", without the region name. The file
350 written will be "{outname}.{encoding}.spl", where
351 {encoding} is the value of the 'encoding' option.
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000352
Bram Moolenaard042c562005-06-30 22:04:15 +0000353 When the output file already exists [!] must be used
Bram Moolenaar520470a2005-06-16 21:59:56 +0000354 to overwrite it.
355
Bram Moolenaar0e21a3f2005-04-17 20:28:32 +0000356 When the [-ascii] argument is present, words with
357 non-ascii characters are skipped. The resulting file
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000358 ends in "ascii.spl".
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000359
360 The input can be the Myspell format files {inname}.aff
361 and {inname}.dic. If {inname}.aff does not exist then
362 {inname} is used as the file name of a plain word
363 list.
364
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000365 Multiple {inname} arguments can be given to combine
366 regions into one Vim spell file. Example: >
367 :mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU
368< This combines the English word lists for US, CA and AU
369 into one en.spl file.
370 Up to eight regions can be combined. *E754* *755*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000371 The REP and SAL items of the first .aff file where
372 they appear are used. |spell-affix-REP|
373 |spell-affix-SAL|
Bram Moolenaar217ad922005-03-20 22:37:15 +0000374
Bram Moolenaar30abd282005-06-22 22:35:10 +0000375 This command uses a lot of memory, required to find
376 the optimal word tree (Polish requires a few hundred
377 Mbyte). The final result will be much smaller.
378
Bram Moolenaard042c562005-06-30 22:04:15 +0000379 After the spell file was written and it was being used
380 in a buffer it will be reloaded automatically.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000381
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000382:mksp[ell] [-ascii] {name}.{enc}.add
383 Like ":mkspell" above, using {name}.{enc}.add as the
Bram Moolenaard042c562005-06-30 22:04:15 +0000384 input file and producing an output file in the same
385 directory that has ".spl" appended.
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000386
387:mksp[ell] [-ascii] {name}
388 Like ":mkspell" above, using {name} as the input file
Bram Moolenaard042c562005-06-30 22:04:15 +0000389 and producing an output file in the same directory
390 that has ".{enc}.spl" appended.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000391
392Since you might want to change a Myspell word list for use with Vim the
393following procedure is recommended:
Bram Moolenaar217ad922005-03-20 22:37:15 +0000394
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +00003951. Obtain the xx_YY.aff and xx_YY.dic files from Myspell.
3962. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic.
3973. Change the xx_YY.aff and xx_YY.dic files to remove bad words, add missing
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000398 words, define word characters with FOL/LOW/UPP, etc. The distributed
399 "src/spell/*.diff" files can be used.
Bram Moolenaard042c562005-06-30 22:04:15 +00004004. Start Vim with the right locale and use |:mkspell| to generate the Vim
401 spell file.
4025. Try out the spell file with ":set spell spelllang=xx" if you wrote it in
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000403 a spell directory in 'runtimepath', or ":set spelllang=xx.enc.spl" if you
Bram Moolenaard042c562005-06-30 22:04:15 +0000404 wrote it somewhere else.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000405
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000406When the Myspell files are updated you can merge the differences:
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00004071. Obtain the new Myspell files as xx_YY.new.aff and xx_UU.new.dic.
4082. Use Vimdiff to see what changed: >
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000409 vimdiff xx_YY.orig.dic xx_YY.new.dic
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00004103. Take over the changes you like in xx_YY.dic.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000411 You may also need to change xx_YY.aff.
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00004124. 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 +0000413
Bram Moolenaar3b506942005-06-23 22:36:45 +0000414
415SPELL FILE DUMP
416
417If for some reason you want to check what words are supported by the currently
418used spelling files, use this command:
419
420 *:spelldump* *:spelld*
421:spelld[ump] Open a new window and fill it with all currently valid
422 words.
Bram Moolenaard042c562005-06-30 22:04:15 +0000423 Note: For some languages the result may be enormous,
424 causing Vim to run out of memory.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000425
426The format of the word list is used |spell-wordlist-format|. You should be
427able to read it with ":mkspell" to generate one .spl file that includes all
428the words.
429
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000430When all entries to 'spelllang' use the same regions or no regions at all then
431the region information is included in the dumped words. Otherwise only words
432for the current region are included and no "/regions" line is generated.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000433
Bram Moolenaard042c562005-06-30 22:04:15 +0000434Comment lines with the name of the .spl file are used as a header above the
435words that were generated from that .spl file.
Bram Moolenaar3b506942005-06-23 22:36:45 +0000436
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000437==============================================================================
Bram Moolenaard042c562005-06-30 22:04:15 +00004384. Spell file format *spell-file-format*
Bram Moolenaar217ad922005-03-20 22:37:15 +0000439
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000440This is the format of the files that are used by the person who creates and
441maintains a word list.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000442
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000443Note that we avoid the word "dictionary" here. That is because the goal of
444spell checking differs from writing a dictionary (as in the book). For
Bram Moolenaard042c562005-06-30 22:04:15 +0000445spelling we need a list of words that are OK, thus should not to be
446highlighted. Person and company names will not appear in a dictionary, but do
447appear in a word list. And some old words are rarely used while they are
448common misspellings. These do appear in a dictionary but not in a word list.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000449
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000450There are two formats: A straight list of words and a list using affix
Bram Moolenaard042c562005-06-30 22:04:15 +0000451compression. The files with affix compression are used by Myspell (Mozilla
452and OpenOffice.org). This requires two files, one with .aff and one with .dic
453extension.
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000454
455
Bram Moolenaard042c562005-06-30 22:04:15 +0000456FORMAT OF STRAIGHT WORD LIST *spell-wordlist-format*
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000457
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000458The words must appear one per line. That is all that is required.
Bram Moolenaard042c562005-06-30 22:04:15 +0000459
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000460Additionally the following items are recognized:
Bram Moolenaard042c562005-06-30 22:04:15 +0000461
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000462- Empty and blank lines are ignored.
Bram Moolenaard042c562005-06-30 22:04:15 +0000463
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000464- Lines starting with a # are ignored (comment lines).
Bram Moolenaard042c562005-06-30 22:04:15 +0000465
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000466- A line starting with "/encoding=", before any word, specifies the encoding
467 of the file. After the second '=' comes an encoding name. This tells Vim
Bram Moolenaard042c562005-06-30 22:04:15 +0000468 to setup conversion from the specified encoding to 'encoding'. Thus you can
469 use one word list for several target encodings.
470
Bram Moolenaar3638c682005-06-08 22:05:14 +0000471- A line starting with "/regions=" specifies the region names that are
472 supported. Each region name must be two ASCII letters. The first one is
473 region 1. Thus "/regions=usca" has region 1 "us" and region 2 "ca".
Bram Moolenaard042c562005-06-30 22:04:15 +0000474 In an addition word list the region names should be equal to the main word
475 list!
476
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000477- Other lines starting with '/' are reserved for future use. The ones that
478 are not recognized are ignored (but you do get a warning message).
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000479
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000480- A "/" may follow the word with the following items:
481 = Case must match exactly.
482 ? Rare word.
483 ! Bad (wrong) word.
484 digit A region in which the word is valid. If no regions are
485 specified the word is valid in all regions.
486
Bram Moolenaar3638c682005-06-08 22:05:14 +0000487Example:
488
489 # This is an example word list comment
490 /encoding=latin1 encoding of the file
491 /regions=uscagb regions "us", "ca" and "gb"
492 example word for all regions
Bram Moolenaar1f8a5f02005-07-01 22:41:52 +0000493 blah/12 word for regions "us" and "ca"
494 vim/! bad word
495 Campbell/?3 rare word in region 3 "gb"
496 's mornings/= keep-case word
Bram Moolenaar3638c682005-06-08 22:05:14 +0000497
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000498Note that when "/=" is used the same word with all upper-case letters is not
499accepted. This is different from a word with mixed case that is automatically
500marked as keep-case, those words may appear in all upper-case letters.
501
Bram Moolenaar75c50c42005-06-04 22:06:24 +0000502
503FORMAT WITH AFFIX COMPRESSION
504
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000505There are two files: the basic word list and an affix file. The affixes are
506used to modify the basic words to get the full word list. This significantly
507reduces the number of words, especially for a language like Polish. This is
508called affix compression.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000509
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000510The format for the affix and word list files is mostly identical to what
511Myspell uses (the spell checker of Mozilla and OpenOffice.org). A description
512can be found here:
513 http://lingucomponent.openoffice.org/affix.readme ~
514Note that affixes are case sensitive, this isn't obvious from the description.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000515
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000516Vim supports a few extras. Hopefully Myspell will support these too some day.
517See |spell-affix-vim|.
Bram Moolenaar217ad922005-03-20 22:37:15 +0000518
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000519The basic word list and the affix file are combined and turned into a binary
520spell file. All the preprocessing has been done, thus this file loads fast.
521The binary spell file format is described in the source code (src/spell.c).
522But only developers need to know about it.
523
524The preprocessing also allows us to take the Myspell language files and modify
525them before the Vim word list is made. The tools for this can be found in the
526"src/spell" directory.
527
528
Bram Moolenaar3638c682005-06-08 22:05:14 +0000529WORD LIST FORMAT *spell-dic-format*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000530
531A very short example, with line numbers:
532
533 1 1234
534 2 aan
535 3 Als
536 4 Etten-Leur
537 5 et al.
538 6 's-Gravenhage
539 7 's-Gravenhaags
540 8 bedel/P
541 9 kado/1
542 10 cadeau/2
543
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000544The first line contains the number of words. Vim ignores it, but you do get
545an error message if it's not there. *E760*
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000546
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000547What follows is one word per line. There should be no white space before or
548after the word.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000549
550When the word only has lower-case letters it will also match with the word
551starting with an upper-case letter.
552
553When the word includes an upper-case letter, this means the upper-case letter
554is required at this position. The same word with a lower-case letter at this
555position will not match. When some of the other letters are upper-case it will
556not match either.
557
Bram Moolenaard042c562005-06-30 22:04:15 +0000558The word with all upper-case characters will always be OK.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000559
560 word list matches does not match ~
561 als als Als ALS ALs AlS aLs aLS
562 Als Als ALS als ALs AlS aLs aLS
563 ALS ALS als Als ALs AlS aLs aLS
564 AlS AlS ALS als Als ALs aLs aLS
565
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000566The KEP affix ID can be used to specifically match a word with identical case
Bram Moolenaare7566042005-06-17 22:00:15 +0000567only, see below |spell-affix-KEP|.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000568
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000569Note in line 5 to 7 that non-word characters are used. You can include
570any character in a word. When checking the text a word still only matches
571when it appears with a non-word character before and after it. For Myspell a
572word starting with a non-word character probably won't work.
573
574After the word there is an optional slash and flags. Most of these flags are
Bram Moolenaard042c562005-06-30 22:04:15 +0000575letters that indicate the affixes that can be used with this word. These are
576specified with SFX and PFX lines in the .aff file. See the Myspell
577documentation.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000578
579 *spell-affix-vim*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000580A flag that Vim adds and is not in Myspell is the flag defined with KEP in the
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000581affix file. This has the meaning that case matters. This can be used if the
582word does not have the first letter in upper case at the start of a sentence.
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000583Example (assuming that = was used for KEP):
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000584
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000585 word list matches does not match ~
586 's morgens/= 's morgens 'S morgens 's Morgens 'S MORGENS
587 's Morgens 's Morgens 'S MORGENS 'S morgens 's morgens
588
589The flag can also be used to avoid that the word matches when it is in all
590upper-case letters.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000591
592 *spell-affix-mbyte*
593The basic word list is normally in an 8-bit encoding, which is mentioned in
594the affix file. The affix file must always be in the same encoding as the
595word list. This is compatible with Myspell. For Vim the encoding may also be
596something else, any encoding that "iconv" supports. The "SET" line must
597specify the name of the encoding. When using a multi-byte encoding it's
Bram Moolenaard042c562005-06-30 22:04:15 +0000598possible to use more different affixes (but Myspell doesn't support that, thus
599you may not want to use it anyway).
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000600
Bram Moolenaare13305e2005-06-19 22:54:15 +0000601
602CHARACTER TABLES
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000603 *spell-affix-chars*
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000604When using an 8-bit encoding the affix file should define what characters are
605word characters (as specified with ENC). This is because the system where
606":mkspell" is used may not support a locale with this encoding and isalpha()
607won't work. For example when using "cp1250" on Unix.
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000608
Bram Moolenaare7566042005-06-17 22:00:15 +0000609 *E761* *E762* *spell-affix-FOL*
610 *spell-affix-LOW* *spell-affix-UPP*
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000611Three lines in the affix file are needed. Simplistic example:
612
Bram Moolenaare13305e2005-06-19 22:54:15 +0000613 FOL áëñ ~
614 LOW áëñ ~
615 UPP ÁËÑ ~
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000616
617All three lines must have exactly the same number of characters.
618
619The "FOL" line specifies the case-folded characters. These are used to
620compare words while ignoring case. For most encodings this is identical to
621the lower case line.
622
623The "LOW" line specifies the characters in lower-case. Mostly it's equal to
624the "FOL" line.
625
626The "UPP" line specifies the characters with upper-case. That is, a character
627is upper-case where it's different from the character at the same position in
628"FOL".
629
630ASCII characters should be omitted, Vim always handles these in the same way.
631When the encoding is UTF-8 no word characters need to be specified.
632
633 *E763*
Bram Moolenaar3b506942005-06-23 22:36:45 +0000634Vim allows you to use spell checking for several languages in the same file.
635You can list them in the 'spelllang' option. As a consequence all spell files
636for the same encoding must use the same word characters, otherwise they can't
637be combined without errors. If you get a warning that the word tables differ
638you may need to generate the .spl file again with |:mkspell|. Check the FOL,
639LOW and UPP lines in the used .aff file.
640
641The XX.ascii.spl spell file generated with the "-ascii" argument will not
642contain the table with characters, so that it can be combine with spell files
643for any encoding. The .add.spl files also do not contain the table.
Bram Moolenaar0cb032e2005-04-23 20:52:00 +0000644
Bram Moolenaare7566042005-06-17 22:00:15 +0000645
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000646MID-WORD CHARACTERS
647 *spell-midword*
648Some characters are only to be considered word characters if they are used in
649between two ordinary word characters. An example is the single quote: It is
650often used to put text in quotes, thus it can't be recognized as a word
651character, but when it appears in between word characters it must be part of
652the word. This is needed to detect a spelling error such as they'are. That
653should be they're, but since "they" and "are" are words themselves that would
654go unnoticed.
655
656These characters are defined with MIDWORD in the .aff file:
657
658 MIDWORD '- ~
659
660
Bram Moolenaare13305e2005-06-19 22:54:15 +0000661AFFIXES
662 *spell-affix-PFX* *spell-affix-SFX*
663The usual PFX (prefix) and SFX (suffix) lines are supported (see the Myspell
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000664documentation or the Aspell manual:
665http://aspell.net/man-html/Affix-Compression.html).
Bram Moolenaare13305e2005-06-19 22:54:15 +0000666
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000667Note that Myspell ignores any extra text after the relevant info. Vim
668requires this text to start with a "#" so that mistakes don't go unnoticed.
669Example:
670
671 SFX F 0 in [^i]n # Spion > Spionin ~
672 SFX F 0 nen in # Bauerin > Bauerinnen ~
673
674An extra item for Vim is the "rare" flag. It must come after the other
675fields, before a comment. When used then all words that use the affix will be
676marked as rare words. Example:
677
678 PFX F 0 nene . rare ~
679 SFX F 0 oin n rare # hardly ever used ~
680
681However, if the word also appears as a good word in another way it won't be
682marked as rare.
Bram Moolenaare13305e2005-06-19 22:54:15 +0000683
684 *spell-affix-PFXPOSTPONE*
685When an affix file has very many prefixes that apply to many words it's not
686possible to build the whole word list in memory. This applies to Hebrew (a
687list with all words is over a Gbyte). In that case applying prefixes must be
688postponed. This makes spell checking slower. It is indicated by this keyword
689in the .aff file:
690
691 PFXPOSTPONE ~
692
693Only prefixes without a chop string can be postponed, prefixes with a chop
Bram Moolenaar78984f52005-08-01 07:19:10 +0000694string will still be included in the word list. An exception if the chop
695string is one character and equal to the last character of the added string,
696but in lower case. Thus when the chop string is used to allow the following
697word to start with an upper case letter.
Bram Moolenaare13305e2005-06-19 22:54:15 +0000698
699
700KEEP-CASE WORDS
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000701 *spell-affix-KEP*
702In the affix file a KEP line can be used to define the affix name used for
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000703keep-case words. Example:
704
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000705 KEP = ~
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000706
707See above for an example |spell-affix-vim|.
708
Bram Moolenaare13305e2005-06-19 22:54:15 +0000709
710RARE WORDS
Bram Moolenaar82cf9b62005-06-07 21:09:25 +0000711 *spell-affix-RAR*
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000712In the affix file a RAR line can be used to define the affix name used for
713rare words. Example:
714
715 RAR ? ~
716
717Rare words are highlighted differently from bad words. This is to be used for
718words that are correct for the language, but are hardly ever used and could be
Bram Moolenaar30abd282005-06-22 22:35:10 +0000719a typing mistake anyway. When the same word is found as good it won't be
720highlighted as rare.
721
722
723BAD WORDS
724 *spell-affix-BAD*
725In the affix file a BAD line can be used to define the affix name used for
726bad words. Example:
727
728 BAD ! ~
729
730This can be used to exclude words that would otherwise be good. For example
Bram Moolenaar9a50b1b2005-06-27 22:48:21 +0000731"the the" in the .dic file:
732
733 the the/! ~
734
735Once a word has been marked as bad it won't be undone by encountering the same
736word as good.
Bram Moolenaar45eeb132005-06-06 21:59:07 +0000737
738
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000739REPLACEMENTS *spell-affix-REP*
740
741In the affix file REP items can be used to define common mistakes. This is
742used to make spelling suggestions. The items define the "from" text and the
743"to" replacement. Example:
744
745 REP 4 ~
746 REP f ph ~
747 REP ph f ~
748 REP k ch ~
749 REP ch k ~
750
751The first line specifies the number of REP lines following. Vim ignores it.
Bram Moolenaard042c562005-06-30 22:04:15 +0000752Don't include simple one-character replacements or swaps. Vim will try these
753anyway. You can include whole words if you want to, but you might want to use
754the "file:" item in 'spellsuggest' instead.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000755
756
757SIMILAR CHARACTERS *spell-affix-MAP*
758
Bram Moolenaard042c562005-06-30 22:04:15 +0000759In the affix file MAP items can be used to define letters that are very much
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000760alike. This is mostly used for a letter with different accents. This is used
761to prefer suggestions with these letters substituted. Example:
762
763 MAP 2 ~
764 MAP eéëêè ~
765 MAP uüùúû ~
766
767The first line specifies the number of MAP lines following. Vim ignores it.
768
Bram Moolenaard042c562005-06-30 22:04:15 +0000769Each letter must appear in only one of the MAP items. It's a bit more
770efficient if the first letter is ASCII or at least one without accents.
Bram Moolenaare7566042005-06-17 22:00:15 +0000771
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000772
Bram Moolenaard042c562005-06-30 22:04:15 +0000773SOUND-A-LIKE *spell-affix-SAL*
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000774
775In the affix file SAL items can be used to define the sounds-a-like mechanism
776to be used. The main items define the "from" text and the "to" replacement.
Bram Moolenaard042c562005-06-30 22:04:15 +0000777Simplistic example:
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000778
779 SAL CIA X ~
780 SAL CH X ~
781 SAL C K ~
782 SAL K K ~
783
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000784There are a few rules and this can become quite complicated. An explanation
Bram Moolenaard042c562005-06-30 22:04:15 +0000785how it works can be found in the Aspell manual:
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000786http://aspell.net/man-html/Phonetic-Code.html.
Bram Moolenaar9ba0eb82005-06-13 22:28:56 +0000787
788There are a few special items:
789
790 SAL followup true ~
791 SAL collapse_result true ~
792 SAL remove_accents true ~
793
794"1" has the same meaning as "true". Any other value means "false".
795
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000796
797SIMPLE SOUNDFOLDING *spell-affix-SOFOFROM* *spell-affix-SOFOTO*
798
799The SAL mechanism is complex and slow. A simpler mechanism is mapping all
800characters to another character, mapping similar sounding characters to the
801same character. At the same time this does case folding. You can not have
Bram Moolenaard042c562005-06-30 22:04:15 +0000802both SAL items and simple soundfolding.
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000803
Bram Moolenaar7d1f5db2005-07-03 21:39:27 +0000804There are two items required: one to specify the characters that are mapped
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000805and one that specifies the characters they are mapped to. They must have
806exactly the same number of characters. Example:
807
808 SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ~
809 SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkes ~
810
811In the example all vowels are mapped to the same character 'e'. Another
Bram Moolenaard042c562005-06-30 22:04:15 +0000812method would be to leave out all vowels. Some characters that sound nearly
813the same and are often mixed up, such as 'm' and 'n', are mapped to the same
814character. Don't do this too much, all words will start looking alike.
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000815
816Characters that do not appear in SOFOFROM will be left out, except that all
817white space is replaced by one space. Sequences of the same character in
818SOFOFROM are replaced by one.
819
820You can use the |soundfold()| function to try out the results. Or set the
821'verbose' option to see the score in the output of the |z?| command.
822
823
Bram Moolenaar217ad922005-03-20 22:37:15 +0000824 vim:tw=78:sw=4:ts=8:ft=help:norl: