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