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