Bram Moolenaar | 1423b9d | 2006-05-07 15:16:06 +0000 | [diff] [blame] | 1 | *spell.txt* For Vim version 7.0. Last change: 2006 Apr 30 |
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 | f9393ef | 2006-04-24 19:47:27 +0000 | [diff] [blame] | 39 | word. Note: this slows down the appearance of the popup menu. Note for GTK: |
| 40 | don't release the right mouse button until the menu appears, otherwise it |
| 41 | won't work. |
Bram Moolenaar | 4536002 | 2005-07-21 21:08:21 +0000 | [diff] [blame] | 42 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 43 | To search for the next misspelled word: |
| 44 | |
| 45 | *]s* *E756* |
| 46 | ]s Move to next misspelled word after the cursor. |
Bram Moolenaar | 9d0ec2e | 2005-04-20 19:45:58 +0000 | [diff] [blame] | 47 | A count before the command can be used to repeat. |
Bram Moolenaar | ac6e65f | 2005-08-29 22:25:38 +0000 | [diff] [blame] | 48 | 'wrapscan' applies. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 49 | |
| 50 | *[s* |
Bram Moolenaar | 9d0ec2e | 2005-04-20 19:45:58 +0000 | [diff] [blame] | 51 | [s Like "]s" but search backwards, find the misspelled |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 52 | word before the cursor. Doesn't recognize words |
| 53 | split over two lines, thus may stop at words that are |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 54 | not highlighted as bad. Does not stop at word with |
| 55 | missing capital at the start of a line. |
Bram Moolenaar | 9d0ec2e | 2005-04-20 19:45:58 +0000 | [diff] [blame] | 56 | |
| 57 | *]S* |
| 58 | ]S Like "]s" but only stop at bad words, not at rare |
| 59 | words or words for another region. |
| 60 | |
| 61 | *[S* |
| 62 | [S Like "]S" but search backwards. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 63 | |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 64 | |
Bram Moolenaar | f75a963 | 2005-09-13 21:20:47 +0000 | [diff] [blame] | 65 | To add words to your own word list: |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 66 | |
| 67 | *zg* |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 68 | 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] | 69 | name in 'spellfile'. A count may precede the command |
| 70 | to indicate the entry in 'spellfile' to be used. A |
| 71 | count of two uses the second entry. |
| 72 | |
| 73 | In Visual mode the selected characters are added as a |
| 74 | word (including white space!). |
| 75 | When the cursor is on text that is marked as badly |
| 76 | spelled then the marked text is used. |
| 77 | Otherwise the word under the cursor, separated by |
| 78 | non-word characters, is used. |
| 79 | |
| 80 | If the word is explicitly marked as bad word in |
| 81 | another spell file the result is unpredictable. |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 82 | |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 83 | *zG* |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 84 | zG Like "zg" but add the word to the internal word list |
| 85 | |internal-wordlist|. |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 86 | |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 87 | *zw* |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 88 | zw Like "zg" but mark the word as a wrong (bad) word. |
Bram Moolenaar | 87b5ca5 | 2006-03-04 21:55:31 +0000 | [diff] [blame] | 89 | If the word already appears in 'spellfile' it is |
| 90 | turned into a comment line. See |spellfile-cleanup| |
| 91 | for getting rid of those. |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 92 | |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 93 | *zW* |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 94 | zW Like "zw" but add the word to the internal word list |
| 95 | |internal-wordlist|. |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 96 | |
Bram Moolenaar | 87b5ca5 | 2006-03-04 21:55:31 +0000 | [diff] [blame] | 97 | zuw *zug* *zuw* |
| 98 | zug Undo |zw| and |zg|, remove the word from the entry in |
| 99 | 'spellfile'. Count used as with |zg|. |
| 100 | |
| 101 | zuW *zuG* *zuW* |
| 102 | zuG Undo |zW| and |zG|, remove the word from the internal |
| 103 | word list. Count used as with |zg|. |
| 104 | |
Bram Moolenaar | 520470a | 2005-06-16 21:59:56 +0000 | [diff] [blame] | 105 | *:spe* *:spellgood* |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 106 | :[count]spe[llgood] {word} |
Bram Moolenaar | 53180ce | 2005-07-05 21:48:14 +0000 | [diff] [blame] | 107 | Add {word} as a good word to 'spellfile', like with |
Bram Moolenaar | 87b5ca5 | 2006-03-04 21:55:31 +0000 | [diff] [blame] | 108 | |zg|. Without count the first name is used, with a |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 109 | count of two the second entry, etc. |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 110 | |
Bram Moolenaar | 53180ce | 2005-07-05 21:48:14 +0000 | [diff] [blame] | 111 | :spe[llgood]! {word} Add {word} as a good word to the internal word list, |
Bram Moolenaar | 87b5ca5 | 2006-03-04 21:55:31 +0000 | [diff] [blame] | 112 | like with |zG|. |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 113 | |
Bram Moolenaar | 520470a | 2005-06-16 21:59:56 +0000 | [diff] [blame] | 114 | *:spellw* *:spellwrong* |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 115 | :[count]spellw[rong] {word} |
Bram Moolenaar | 53180ce | 2005-07-05 21:48:14 +0000 | [diff] [blame] | 116 | Add {word} as a wrong (bad) word to 'spellfile', as |
Bram Moolenaar | 87b5ca5 | 2006-03-04 21:55:31 +0000 | [diff] [blame] | 117 | with |zw|. Without count the first name is used, with |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 118 | a count of two the second entry, etc. |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 119 | |
Bram Moolenaar | 53180ce | 2005-07-05 21:48:14 +0000 | [diff] [blame] | 120 | :spellw[rong]! {word} Add {word} as a wrong (bad) word to the internal word |
Bram Moolenaar | 87b5ca5 | 2006-03-04 21:55:31 +0000 | [diff] [blame] | 121 | list, like with |zW|. |
| 122 | |
| 123 | :[count]spellu[ndo] {word} *:spellu* *:spellundo* |
| 124 | Like |zuw|. [count] used as with |:spellgood|. |
| 125 | |
| 126 | :spellu[ndo]! {word} Like |zuW|. [count] used as with |:spellgood|. |
| 127 | |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 128 | |
Bram Moolenaar | f461c8e | 2005-06-25 23:04:51 +0000 | [diff] [blame] | 129 | After adding a word to 'spellfile' with the above commands its associated |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 130 | ".spl" file will automatically be updated and reloaded. If you change |
| 131 | 'spellfile' manually you need to use the |:mkspell| command. This sequence of |
| 132 | commands mostly works well: > |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 133 | :edit <file in 'spellfile'> |
Bram Moolenaar | f461c8e | 2005-06-25 23:04:51 +0000 | [diff] [blame] | 134 | < (make changes to the spell file) > |
| 135 | :mkspell! % |
| 136 | |
| 137 | More details about the 'spellfile' format below |spell-wordlist-format|. |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 138 | |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 139 | *internal-wordlist* |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 140 | The internal word list is used for all buffers where 'spell' is set. It is |
| 141 | not stored, it is lost when you exit Vim. It is also cleared when 'encoding' |
| 142 | is set. |
| 143 | |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 144 | |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 145 | Finding suggestions for bad words: |
Bram Moolenaar | cc016f5 | 2005-12-10 20:23:46 +0000 | [diff] [blame] | 146 | *z=* |
| 147 | z= For the word under/after the cursor suggest correctly |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 148 | spelled words. This also works to find alternatives |
| 149 | for a word that is not highlighted as a bad word, |
| 150 | e.g., when the word after it is bad. |
Bram Moolenaar | 7df351e | 2006-01-23 22:30:28 +0000 | [diff] [blame] | 151 | In Visual mode the highlighted text is taken as the |
| 152 | word to be replaced. |
| 153 | The results are sorted on similarity to the word being |
| 154 | replaced. |
Bram Moolenaar | 90915b5 | 2005-08-21 22:17:52 +0000 | [diff] [blame] | 155 | This may take a long time. Hit CTRL-C when you get |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 156 | bored. |
Bram Moolenaar | 90915b5 | 2005-08-21 22:17:52 +0000 | [diff] [blame] | 157 | |
| 158 | If the command is used without a count the |
| 159 | alternatives are listed and you can enter the number |
| 160 | of your choice or press <Enter> if you don't want to |
| 161 | replace. You can also use the mouse to click on your |
| 162 | choice (only works if the mouse can be used in Normal |
| 163 | mode and when there are no line wraps). Click on the |
| 164 | first line (the header) to cancel. |
| 165 | |
Bram Moolenaar | fc1421e | 2006-04-20 22:17:20 +0000 | [diff] [blame] | 166 | The suggestions listed normally replace a highlighted |
| 167 | bad word. Sometimes they include other text, in that |
| 168 | case the replaced text is also listed after a "<". |
| 169 | |
Bram Moolenaar | 90915b5 | 2005-08-21 22:17:52 +0000 | [diff] [blame] | 170 | If a count is used that suggestion is used, without |
Bram Moolenaar | cc016f5 | 2005-12-10 20:23:46 +0000 | [diff] [blame] | 171 | prompting. For example, "1z=" always takes the first |
Bram Moolenaar | 90915b5 | 2005-08-21 22:17:52 +0000 | [diff] [blame] | 172 | suggestion. |
| 173 | |
| 174 | If 'verbose' is non-zero a score will be displayed |
| 175 | with the suggestions to indicate the likeliness to the |
| 176 | badly spelled word (the higher the score the more |
| 177 | different). |
Bram Moolenaar | d857f0e | 2005-06-21 22:37:39 +0000 | [diff] [blame] | 178 | When a word was replaced the redo command "." will |
| 179 | repeat the word replacement. This works like "ciw", |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 180 | the good word and <Esc>. This does NOT work for Thai |
| 181 | and other languages without spaces between words. |
Bram Moolenaar | d857f0e | 2005-06-21 22:37:39 +0000 | [diff] [blame] | 182 | |
Bram Moolenaar | 24bbcfe | 2005-06-28 23:32:02 +0000 | [diff] [blame] | 183 | *:spellr* *:spellrepall* *E752* *E753* |
Bram Moolenaar | cc016f5 | 2005-12-10 20:23:46 +0000 | [diff] [blame] | 184 | :spellr[epall] Repeat the replacement done by |z=| for all matches |
Bram Moolenaar | 24bbcfe | 2005-06-28 23:32:02 +0000 | [diff] [blame] | 185 | with the replaced word in the current window. |
| 186 | |
Bram Moolenaar | 488c651 | 2005-08-11 20:09:58 +0000 | [diff] [blame] | 187 | In Insert mode, when the cursor is after a badly spelled word, you can use |
| 188 | CTRL-X s to find suggestions. This works like Insert mode completion. Use |
| 189 | CTRL-N to use the next suggestion, CTRL-P to go back. |i_CTRL-X_s| |
| 190 | |
Bram Moolenaar | d857f0e | 2005-06-21 22:37:39 +0000 | [diff] [blame] | 191 | The 'spellsuggest' option influences how the list of suggestions is generated |
| 192 | and sorted. See |'spellsuggest'|. |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 193 | |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 194 | The 'spellcapcheck' option is used to check the first word of a sentence |
| 195 | starts with a capital. This doesn't work for the first word in the file. |
| 196 | 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] | 197 | line may be postponed. Use |CTRL-L| when needed. Also see |set-spc-auto| for |
| 198 | how it can be set automatically when 'spelllang' is set. |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 199 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 200 | Vim counts the number of times a good word is encountered. This is used to |
| 201 | sort the suggestions: words that have been seen before get a small bonus, |
| 202 | words that have been seen often get a bigger bonus. The COMMON item in the |
| 203 | affix file can be used to define common words, so that this mechanism also |
| 204 | works in a new or short file |spell-COMMON|. |
| 205 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 206 | ============================================================================== |
| 207 | 2. Remarks on spell checking *spell-remarks* |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 208 | |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 209 | PERFORMANCE |
| 210 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 211 | Vim does on-the-fly spell checking. To make this work fast the word list is |
| 212 | loaded in memory. Thus this uses a lot of memory (1 Mbyte or more). There |
| 213 | might also be a noticeable delay when the word list is loaded, which happens |
| 214 | when 'spell' is set and when 'spelllang' is set while 'spell' was already set. |
| 215 | To minimize the delay each word list is only loaded once, it is not deleted |
| 216 | when 'spelllang' is made empty or 'spell' is reset. When 'encoding' is set |
| 217 | 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] | 218 | |
| 219 | |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 220 | REGIONS |
| 221 | |
| 222 | A word may be spelled differently in various regions. For example, English |
| 223 | comes in (at least) these variants: |
| 224 | |
| 225 | en all regions |
Bram Moolenaar | 5c5474b | 2005-04-19 21:40:26 +0000 | [diff] [blame] | 226 | en_au Australia |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 227 | en_ca Canada |
Bram Moolenaar | 5c5474b | 2005-04-19 21:40:26 +0000 | [diff] [blame] | 228 | en_gb Great Britain |
| 229 | en_nz New Zealand |
| 230 | en_us USA |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 231 | |
| 232 | 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] | 233 | highlighted with SpellLocal |hl-SpellLocal|. |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 234 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 235 | Always use lowercase letters for the language and region names. |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 236 | |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 237 | When adding a word with |zg| or another command it's always added for all |
| 238 | regions. You can change that by manually editing the 'spellfile'. See |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 239 | |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] | 240 | 'spellfile' are only used when all entries in 'spelllang' specify the same |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 241 | region (not counting files specified by their .spl name). |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 242 | |
Bram Moolenaar | 5b8d8fd | 2005-08-16 23:01:50 +0000 | [diff] [blame] | 243 | *spell-german* |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 244 | Specific exception: For German these special regions are used: |
| 245 | de all German words accepted |
| 246 | de_de old and new spelling |
| 247 | de_19 old spelling |
| 248 | de_20 new spelling |
| 249 | de_at Austria |
| 250 | de_ch Switzerland |
| 251 | |
Bram Moolenaar | 92d640f | 2005-09-05 22:11:52 +0000 | [diff] [blame] | 252 | *spell-russian* |
| 253 | Specific exception: For Russian these special regions are used: |
| 254 | ru all Russian words accepted |
| 255 | ru_ru "IE" letter spelling |
| 256 | ru_yo "YO" letter spelling |
| 257 | |
Bram Moolenaar | 5b8d8fd | 2005-08-16 23:01:50 +0000 | [diff] [blame] | 258 | *spell-yiddish* |
| 259 | Yiddish requires using "utf-8" encoding, because of the special characters |
| 260 | used. If you are using latin1 Vim will use transliterated (romanized) Yiddish |
| 261 | instead. If you want to use transliterated Yiddish with utf-8 use "yi-tr". |
| 262 | In a table: |
| 263 | 'encoding' 'spelllang' |
| 264 | utf-8 yi Yiddish |
| 265 | latin1 yi transliterated Yiddish |
| 266 | utf-8 yi-tr transliterated Yiddish |
| 267 | |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 268 | |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 269 | SPELL FILES *spell-load* |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 270 | |
| 271 | 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] | 272 | 'runtimepath'. The name is: LL.EEE.spl, where: |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 273 | LL the language name |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 274 | EEE the value of 'encoding' |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 275 | |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 276 | The value for "LL" comes from 'spelllang', but excludes the region name. |
| 277 | Examples: |
| 278 | 'spelllang' LL ~ |
| 279 | en_us en |
| 280 | en-rare en-rare |
| 281 | medical_ca medical |
| 282 | |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 283 | Only the first file is loaded, the one that is first in 'runtimepath'. If |
| 284 | this succeeds then additionally files with the name LL.EEE.add.spl are loaded. |
| 285 | All the ones that are found are used. |
| 286 | |
Bram Moolenaar | 1ef15e3 | 2006-02-01 21:56:25 +0000 | [diff] [blame] | 287 | If no spell file is found the |SpellFileMissing| autocommand event is |
| 288 | triggered. This may trigger the |spellfile.vim| plugin to offer you |
| 289 | downloading the spell file. |
| 290 | |
Bram Moolenaar | 0d9c26d | 2005-07-02 23:19:16 +0000 | [diff] [blame] | 291 | Additionally, the files related to the names in 'spellfile' are loaded. These |
| 292 | 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] | 293 | |
Bram Moolenaar | 0e21a3f | 2005-04-17 20:28:32 +0000 | [diff] [blame] | 294 | Exceptions: |
| 295 | - Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign doesn't |
| 296 | matter for spelling. |
| 297 | - When no spell file for 'encoding' is found "ascii" is tried. This only |
| 298 | works for languages where nearly all words are ASCII, such as English. It |
| 299 | 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] | 300 | is being edited. For the ".add" files the same name as the found main |
| 301 | spell file is used. |
| 302 | |
| 303 | For example, with these values: |
| 304 | 'runtimepath' is "~/.vim,/usr/share/vim70,~/.vim/after" |
| 305 | 'encoding' is "iso-8859-2" |
| 306 | 'spelllang' is "pl" |
| 307 | |
| 308 | Vim will look for: |
| 309 | 1. ~/.vim/spell/pl.iso-8859-2.spl |
| 310 | 2. /usr/share/vim70/spell/pl.iso-8859-2.spl |
| 311 | 3. ~/.vim/spell/pl.iso-8859-2.add.spl |
| 312 | 4. /usr/share/vim70/spell/pl.iso-8859-2.add.spl |
| 313 | 5. ~/.vim/after/spell/pl.iso-8859-2.add.spl |
| 314 | |
| 315 | This assumes 1. is not found and 2. is found. |
| 316 | |
| 317 | If 'encoding' is "latin1" Vim will look for: |
| 318 | 1. ~/.vim/spell/pl.latin1.spl |
| 319 | 2. /usr/share/vim70/spell/pl.latin1.spl |
| 320 | 3. ~/.vim/after/spell/pl.latin1.spl |
| 321 | 4. ~/.vim/spell/pl.ascii.spl |
| 322 | 5. /usr/share/vim70/spell/pl.ascii.spl |
| 323 | 6. ~/.vim/after/spell/pl.ascii.spl |
| 324 | |
| 325 | This assumes none of them are found (Polish doesn't make sense when leaving |
| 326 | out the non-ASCII characters). |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 327 | |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 328 | Spelling for EBCDIC is currently not supported. |
| 329 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 330 | A spell file might not be available in the current 'encoding'. See |
| 331 | |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] | 332 | with "iconv" will NOT work! |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 333 | |
Bram Moolenaar | a40ceaf | 2006-01-13 22:35:40 +0000 | [diff] [blame] | 334 | *spell-sug-file* *E781* |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 335 | If there is a file with exactly the same name as the ".spl" file but ending in |
| 336 | ".sug", that file will be used for giving better suggestions. It isn't loaded |
| 337 | before suggestions are made to reduce memory use. |
| 338 | |
Bram Moolenaar | a40ceaf | 2006-01-13 22:35:40 +0000 | [diff] [blame] | 339 | *E758* *E759* *E778* *E779* *E780* *E782* |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 340 | 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] | 341 | get an error the file may be truncated, modified or intended for another Vim |
| 342 | version. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 343 | |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 344 | |
Bram Moolenaar | 87b5ca5 | 2006-03-04 21:55:31 +0000 | [diff] [blame] | 345 | SPELLFILE CLEANUP *spellfile-cleanup* |
| 346 | |
| 347 | The |zw| command turns existing entries in 'spellfile' into comment lines. |
| 348 | This avoids having to write a new file every time, but results in the file |
| 349 | only getting longer, never shorter. To clean up the comment lines in all |
| 350 | ".add" spell files do this: > |
| 351 | :runtime spell/cleanadd.vim |
| 352 | |
| 353 | This deletes all comment lines, except the ones that start with "##". Use |
| 354 | "##" lines to add comments that you want to keep. |
| 355 | |
| 356 | You can invoke this script as often as you like. A variable is provided to |
| 357 | skip updating files that have been changed recently. Set it to the number of |
| 358 | seconds that has passed since a file was changed before it will be cleaned. |
| 359 | For example, to clean only files that were not changed in the last hour: > |
| 360 | let g:spell_clean_limit = 60 * 60 |
| 361 | The default is one second. |
| 362 | |
| 363 | |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 364 | WORDS |
| 365 | |
| 366 | Vim uses a fixed method to recognize a word. This is independent of |
| 367 | 'iskeyword', so that it also works in help files and for languages that |
| 368 | include characters like '-' in 'iskeyword'. The word characters do depend on |
| 369 | 'encoding'. |
| 370 | |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 371 | The table with word characters is stored in the main .spl file. Therefore it |
| 372 | 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] | 373 | not contain a word table though. |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 374 | |
Bram Moolenaar | f9393ef | 2006-04-24 19:47:27 +0000 | [diff] [blame] | 375 | For a word that starts with a digit the digit is ignored, unless the word as a |
| 376 | whole is recognized. Thus if "3D" is a word and "D" is not then "3D" is |
| 377 | recognized as a word, but if "3D" is not a word then only the "D" is marked as |
| 378 | bad. Hex numbers in the form 0x12ab and 0X12AB are recognized. |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 379 | |
| 380 | |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 381 | WORD COMBINATIONS |
| 382 | |
| 383 | It is possible to spell-check words that include a space. This is used to |
| 384 | recognize words that are invalid when used by themselves, e.g. for "et al.". |
| 385 | It can also be used to recognize "the the" and highlight it. |
| 386 | |
| 387 | The number of spaces is irrelevant. In most cases a line break may also |
| 388 | appear. However, this makes it difficult to find out where to start checking |
| 389 | for spelling mistakes. When you make a change to one line and only that line |
| 390 | is redrawn Vim won't look in the previous line, thus when "et" is at the end |
| 391 | of the previous line "al." will be flagged as an error. And when you type |
| 392 | "the<CR>the" the highlighting doesn't appear until the first line is redrawn. |
| 393 | Use |CTRL-L| to redraw right away. "[s" will also stop at a word combination |
| 394 | with a line break. |
| 395 | |
| 396 | When encountering a line break Vim skips characters such as '*', '>' and '"', |
| 397 | so that comments in C, shell and Vim code can be spell checked. |
| 398 | |
| 399 | |
Bram Moolenaar | 9d0ec2e | 2005-04-20 19:45:58 +0000 | [diff] [blame] | 400 | SYNTAX HIGHLIGHTING *spell-syntax* |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 401 | |
| 402 | Files that use syntax highlighting can specify where spell checking should be |
| 403 | done: |
| 404 | |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 405 | 1. everywhere default |
| 406 | 2. in specific items use "contains=@Spell" |
| 407 | 3. everywhere but specific items use "contains=@NoSpell" |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 408 | |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 409 | For the second method adding the @NoSpell cluster will disable spell checking |
| 410 | again. This can be used, for example, to add @Spell to the comments of a |
| 411 | program, and add @NoSpell for items that shouldn't be checked. |
Bram Moolenaar | 6bb6836 | 2005-03-22 23:03:44 +0000 | [diff] [blame] | 412 | |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 413 | |
| 414 | VIM SCRIPTS |
| 415 | |
| 416 | If you want to write a Vim script that does something with spelling, you may |
| 417 | find these functions useful: |
| 418 | |
| 419 | spellbadword() find badly spelled word at the cursor |
| 420 | spellsuggest() get list of spelling suggestions |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 421 | soundfold() get the sound-a-like version of a word |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 422 | |
Bram Moolenaar | 90cfdbe | 2005-08-12 19:59:19 +0000 | [diff] [blame] | 423 | |
| 424 | SETTING 'spellcapcheck' AUTOMATICALLY *set-spc-auto* |
| 425 | |
| 426 | After the 'spelllang' option has been set successfully, Vim will source the |
| 427 | files "spell/LANG.vim" in 'runtimepath'. "LANG" is the value of 'spelllang' |
| 428 | up to the first comma, dot or underscore. This can be used to set options |
| 429 | specifically for the language, especially 'spellcapcheck'. |
| 430 | |
| 431 | The distribution includes a few of these files. Use this command to see what |
| 432 | they do: > |
| 433 | :next $VIMRUNTIME/spell/*.vim |
| 434 | |
| 435 | Note that the default scripts don't set 'spellcapcheck' if it was changed from |
| 436 | the default value. This assumes the user prefers another value then. |
| 437 | |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 438 | |
| 439 | DOUBLE SCORING *spell-double-scoring* |
| 440 | |
| 441 | The 'spellsuggest' option can be used to select "double" scoring. This |
| 442 | mechanism is based on the principle that there are two kinds of spelling |
| 443 | mistakes: |
| 444 | |
| 445 | 1. You know how to spell the word, but mistype something. This results in a |
| 446 | small editing distance (character swapped/omitted/inserted) and possibly a |
| 447 | word that sounds completely different. |
| 448 | |
| 449 | 2. You don't know how to spell the word and type something that sounds right. |
| 450 | The edit distance can be big but the word is similar after sound-folding. |
| 451 | |
| 452 | Since scores for these two mistakes will be very different we use a list |
| 453 | for each and mix them. |
| 454 | |
| 455 | The sound-folding is slow and people that know the language won't make the |
| 456 | second kind of mistakes. Therefore 'spellsuggest' can be set to select the |
| 457 | preferred method for scoring the suggestions. |
| 458 | |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 459 | ============================================================================== |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 460 | 3. Generating a spell file *spell-mkspell* |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 461 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 462 | Vim uses a binary file format for spelling. This greatly speeds up loading |
| 463 | the word list and keeps it small. |
Bram Moolenaar | 9a50b1b | 2005-06-27 22:48:21 +0000 | [diff] [blame] | 464 | *.aff* *.dic* *Myspell* |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 465 | You can create a Vim spell file from the .aff and .dic files that Myspell |
| 466 | uses. Myspell is used by OpenOffice.org and Mozilla. You should be able to |
| 467 | find them here: |
| 468 | http://lingucomponent.openoffice.org/spell_dic.html |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 469 | 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] | 470 | depends on what word lists you can find. |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 471 | |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 472 | If you install Aap (from www.a-a-p.org) you can use the recipes in the |
| 473 | runtime/spell/??/ directories. Aap will take care of downloading the files, |
| 474 | apply patches needed for Vim and build the .spl file. |
| 475 | |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 476 | Make sure your current locale is set properly, otherwise Vim doesn't know what |
| 477 | characters are upper/lower case letters. If the locale isn't available (e.g., |
| 478 | 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] | 479 | |spell-affix-chars|. If the .aff file doesn't define a table then the word |
| 480 | table of the currently active spelling is used. If spelling is not active |
| 481 | then Vim will try to guess. |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 482 | |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 483 | *:mksp* *:mkspell* |
| 484 | :mksp[ell][!] [-ascii] {outname} {inname} ... |
Bram Moolenaar | 16d8f87 | 2005-11-26 23:46:11 +0000 | [diff] [blame] | 485 | Generate a Vim spell file from word lists. Example: > |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 486 | :mkspell /tmp/nl nl_NL.words |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 487 | < *E751* |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 488 | When {outname} ends in ".spl" it is used as the output |
| 489 | file name. Otherwise it should be a language name, |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 490 | such as "en", without the region name. The file |
| 491 | written will be "{outname}.{encoding}.spl", where |
| 492 | {encoding} is the value of the 'encoding' option. |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 493 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 494 | When the output file already exists [!] must be used |
Bram Moolenaar | 520470a | 2005-06-16 21:59:56 +0000 | [diff] [blame] | 495 | to overwrite it. |
| 496 | |
Bram Moolenaar | 0e21a3f | 2005-04-17 20:28:32 +0000 | [diff] [blame] | 497 | When the [-ascii] argument is present, words with |
| 498 | non-ascii characters are skipped. The resulting file |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 499 | ends in "ascii.spl". |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 500 | |
| 501 | The input can be the Myspell format files {inname}.aff |
| 502 | and {inname}.dic. If {inname}.aff does not exist then |
| 503 | {inname} is used as the file name of a plain word |
| 504 | list. |
| 505 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 506 | Multiple {inname} arguments can be given to combine |
| 507 | regions into one Vim spell file. Example: > |
| 508 | :mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU |
| 509 | < This combines the English word lists for US, CA and AU |
| 510 | into one en.spl file. |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 511 | Up to eight regions can be combined. *E754* *E755* |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 512 | The REP and SAL items of the first .aff file where |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 513 | they appear are used. |spell-REP| |spell-SAL| |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 514 | |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 515 | This command uses a lot of memory, required to find |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 516 | the optimal word tree (Polish, Italian and Hungarian |
| 517 | require several hundred Mbyte). The final result will |
| 518 | be much smaller, because compression is used. To |
| 519 | avoid running out of memory compression will be done |
| 520 | now and then. This can be tuned with the 'mkspellmem' |
| 521 | option. |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 522 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 523 | After the spell file was written and it was being used |
| 524 | in a buffer it will be reloaded automatically. |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 525 | |
Bram Moolenaar | 9a50b1b | 2005-06-27 22:48:21 +0000 | [diff] [blame] | 526 | :mksp[ell] [-ascii] {name}.{enc}.add |
| 527 | Like ":mkspell" above, using {name}.{enc}.add as the |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 528 | input file and producing an output file in the same |
| 529 | directory that has ".spl" appended. |
Bram Moolenaar | 9a50b1b | 2005-06-27 22:48:21 +0000 | [diff] [blame] | 530 | |
| 531 | :mksp[ell] [-ascii] {name} |
| 532 | Like ":mkspell" above, using {name} as the input file |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 533 | and producing an output file in the same directory |
| 534 | that has ".{enc}.spl" appended. |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 535 | |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 536 | Vim will report the number of duplicate words. This might be a mistake in the |
| 537 | list of words. But sometimes it is used to have different prefixes and |
| 538 | 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] | 539 | this). If you want Vim to report all duplicate words set the 'verbose' |
| 540 | option. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 541 | |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 542 | Since you might want to change a Myspell word list for use with Vim the |
| 543 | following procedure is recommended: |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 544 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 545 | 1. Obtain the xx_YY.aff and xx_YY.dic files from Myspell. |
| 546 | 2. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic. |
| 547 | 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] | 548 | words, define word characters with FOL/LOW/UPP, etc. The distributed |
| 549 | "src/spell/*.diff" files can be used. |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 550 | 4. Start Vim with the right locale and use |:mkspell| to generate the Vim |
| 551 | spell file. |
| 552 | 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] | 553 | 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] | 554 | wrote it somewhere else. |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 555 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 556 | When the Myspell files are updated you can merge the differences: |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 557 | 1. Obtain the new Myspell files as xx_YY.new.aff and xx_UU.new.dic. |
| 558 | 2. Use Vimdiff to see what changed: > |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 559 | vimdiff xx_YY.orig.dic xx_YY.new.dic |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 560 | 3. Take over the changes you like in xx_YY.dic. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 561 | You may also need to change xx_YY.aff. |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 562 | 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] | 563 | |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 564 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 565 | SPELL FILE VERSIONS *E770* *E771* *E772* |
| 566 | |
| 567 | Spell checking is a relatively new feature in Vim, thus it's possible that the |
| 568 | .spl file format will be changed to support more languages. Vim will check |
| 569 | the validity of the spell file and report anything wrong. |
| 570 | |
| 571 | E771: Old spell file, needs to be updated ~ |
| 572 | This spell file is older than your Vim. You need to update the .spl file. |
| 573 | |
| 574 | E772: Spell file is for newer version of Vim ~ |
| 575 | This means the spell file was made for a later version of Vim. You need to |
| 576 | update Vim. |
| 577 | |
| 578 | E770: Unsupported section in spell file ~ |
| 579 | This means the spell file was made for a later version of Vim and contains a |
| 580 | section that is required for the spell file to work. In this case it's |
| 581 | probably a good idea to upgrade your Vim. |
| 582 | |
| 583 | |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 584 | SPELL FILE DUMP |
| 585 | |
| 586 | If for some reason you want to check what words are supported by the currently |
| 587 | used spelling files, use this command: |
| 588 | |
| 589 | *:spelldump* *:spelld* |
| 590 | :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] | 591 | words. Compound words are not included. |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 592 | Note: For some languages the result may be enormous, |
| 593 | causing Vim to run out of memory. |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 594 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 595 | :spelld[ump]! Like ":spelldump" and include the word count. This is |
| 596 | the number of times the word was found while |
| 597 | updating the screen. Words that are in COMMON items |
| 598 | get a starting count of 10. |
| 599 | |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 600 | The format of the word list is used |spell-wordlist-format|. You should be |
| 601 | able to read it with ":mkspell" to generate one .spl file that includes all |
| 602 | the words. |
| 603 | |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 604 | When all entries to 'spelllang' use the same regions or no regions at all then |
| 605 | the region information is included in the dumped words. Otherwise only words |
| 606 | for the current region are included and no "/regions" line is generated. |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 607 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 608 | Comment lines with the name of the .spl file are used as a header above the |
| 609 | words that were generated from that .spl file. |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 610 | |
Bram Moolenaar | 1ef15e3 | 2006-02-01 21:56:25 +0000 | [diff] [blame] | 611 | |
| 612 | SPELL FILE MISSING *spell-SpellFileMissing* *spellfile.vim* |
| 613 | |
| 614 | If the spell file for the language you are using is not available, you will |
| 615 | get an error message. But if the "spellfile.vim" plugin is active it will |
| 616 | offer you to download the spell file. Just follow the instructions, it will |
| 617 | ask you where to write the file. |
| 618 | |
| 619 | The plugin has a default place where to look for spell files, on the Vim ftp |
| 620 | server. If you want to use another location or another protocol, set the |
| 621 | g:spellfile_URL variable to the directory that holds the spell files. The |
| 622 | |netrw| plugin is used for getting the file, look there for the speficic |
| 623 | syntax of the URL. Example: > |
| 624 | let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' |
| 625 | You may need to escape special characters. |
| 626 | |
| 627 | The plugin will only ask about downloading a language once. If you want to |
| 628 | try again anyway restart Vim, or set g:spellfile_URL to another value (e.g., |
| 629 | prepend a space). |
| 630 | |
| 631 | To avoid using the "spellfile.vim" plugin do this in your vimrc file: > |
| 632 | |
| 633 | let loaded_spellfile_plugin = 1 |
| 634 | |
| 635 | Instead of using the plugin you can define a |SpellFileMissing| autocommand to |
| 636 | handle the missing file yourself. You can use it like this: > |
| 637 | |
| 638 | :au SpellFileMissing * call Download_spell_file(expand('<amatch>')) |
| 639 | |
| 640 | Thus the <amatch> item contains the name of the language. Another important |
| 641 | value is 'encoding', since every encoding has its own spell file. With two |
| 642 | exceptions: |
| 643 | - For ISO-8859-15 (latin9) the name "latin1" is used (the encodings only |
| 644 | differ in characters not used in dictionary words). |
| 645 | - The name "ascii" may also be used for some languages where the words use |
| 646 | only ASCII letters for most of the words. |
| 647 | |
| 648 | The default "spellfile.vim" plugin uses this autocommand, if you define your |
| 649 | autocommand afterwars you may want to use ":au! SpellFileMissing" to overrule |
| 650 | it. If you define your autocommand before the plugin is loaded it will notice |
| 651 | this and not do anything. |
| 652 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 653 | ============================================================================== |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 654 | 4. Spell file format *spell-file-format* |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 655 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 656 | This is the format of the files that are used by the person who creates and |
| 657 | maintains a word list. |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 658 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 659 | Note that we avoid the word "dictionary" here. That is because the goal of |
| 660 | spell checking differs from writing a dictionary (as in the book). For |
Bram Moolenaar | 16d8f87 | 2005-11-26 23:46:11 +0000 | [diff] [blame] | 661 | spelling we need a list of words that are OK, thus should not be highlighted. |
| 662 | Person and company names will not appear in a dictionary, but do appear in a |
| 663 | word list. And some old words are rarely used while they are common |
| 664 | 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] | 665 | |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 666 | 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] | 667 | compression. The files with affix compression are used by Myspell (Mozilla |
| 668 | and OpenOffice.org). This requires two files, one with .aff and one with .dic |
| 669 | extension. |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 670 | |
| 671 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 672 | FORMAT OF STRAIGHT WORD LIST *spell-wordlist-format* |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 673 | |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 674 | 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] | 675 | |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 676 | Additionally the following items are recognized: |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 677 | |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 678 | - Empty and blank lines are ignored. |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 679 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 680 | # comment ~ |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 681 | - Lines starting with a # are ignored (comment lines). |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 682 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 683 | /encoding=utf-8 ~ |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 684 | - A line starting with "/encoding=", before any word, specifies the encoding |
| 685 | 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] | 686 | to setup conversion from the specified encoding to 'encoding'. Thus you can |
| 687 | use one word list for several target encodings. |
| 688 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 689 | /regions=usca ~ |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 690 | - A line starting with "/regions=" specifies the region names that are |
| 691 | supported. Each region name must be two ASCII letters. The first one is |
| 692 | 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] | 693 | In an addition word list the region names should be equal to the main word |
| 694 | list! |
| 695 | |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 696 | - Other lines starting with '/' are reserved for future use. The ones that |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 697 | are not recognized are ignored. You do get a warning message, so that you |
| 698 | know something won't work. |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 699 | |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 700 | - A "/" may follow the word with the following items: |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 701 | = Case must match exactly. |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 702 | ? Rare word. |
| 703 | ! Bad (wrong) word. |
| 704 | digit A region in which the word is valid. If no regions are |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 705 | specified the word is valid in all regions. |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 706 | |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 707 | Example: |
| 708 | |
| 709 | # This is an example word list comment |
| 710 | /encoding=latin1 encoding of the file |
| 711 | /regions=uscagb regions "us", "ca" and "gb" |
| 712 | example word for all regions |
Bram Moolenaar | 1f8a5f0 | 2005-07-01 22:41:52 +0000 | [diff] [blame] | 713 | blah/12 word for regions "us" and "ca" |
| 714 | vim/! bad word |
| 715 | Campbell/?3 rare word in region 3 "gb" |
| 716 | 's mornings/= keep-case word |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 717 | |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 718 | Note that when "/=" is used the same word with all upper-case letters is not |
| 719 | accepted. This is different from a word with mixed case that is automatically |
| 720 | marked as keep-case, those words may appear in all upper-case letters. |
| 721 | |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 722 | |
Bram Moolenaar | 8dff818 | 2006-04-06 20:18:50 +0000 | [diff] [blame] | 723 | FORMAT WITH .AFF AND .DIC FILES *aff-dic-format* |
Bram Moolenaar | 75c50c4 | 2005-06-04 22:06:24 +0000 | [diff] [blame] | 724 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 725 | There are two files: the basic word list and an affix file. The affix file |
| 726 | specifies settings for the language and can contain affixes. The affixes are |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 727 | used to modify the basic words to get the full word list. This significantly |
| 728 | reduces the number of words, especially for a language like Polish. This is |
| 729 | called affix compression. |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 730 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 731 | The basic word list and the affix file are combined with the ":mkspell" |
| 732 | command and results in a binary spell file. All the preprocessing has been |
| 733 | done, thus this file loads fast. The binary spell file format is described in |
| 734 | the source code (src/spell.c). But only developers need to know about it. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 735 | |
| 736 | The preprocessing also allows us to take the Myspell language files and modify |
| 737 | them before the Vim word list is made. The tools for this can be found in the |
| 738 | "src/spell" directory. |
| 739 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 740 | The format for the affix and word list files is based on what Myspell uses |
| 741 | (the spell checker of Mozilla and OpenOffice.org). A description can be found |
| 742 | here: |
| 743 | http://lingucomponent.openoffice.org/affix.readme ~ |
| 744 | Note that affixes are case sensitive, this isn't obvious from the description. |
| 745 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 746 | Vim supports quite a few extras. They are described below |spell-affix-vim|. |
| 747 | Attempts have been made to keep this compatible with other spell checkers, so |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 748 | that the same files can often be used. One other project that offers more |
| 749 | than Myspell is Hunspell ( http://hunspell.sf.net ). |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 750 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 751 | |
Bram Moolenaar | 3638c68 | 2005-06-08 22:05:14 +0000 | [diff] [blame] | 752 | WORD LIST FORMAT *spell-dic-format* |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 753 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 754 | A short example, with line numbers: |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 755 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 756 | 1 1234 ~ |
| 757 | 2 aan ~ |
| 758 | 3 Als ~ |
| 759 | 4 Etten-Leur ~ |
| 760 | 5 et al. ~ |
| 761 | 6 's-Gravenhage ~ |
| 762 | 7 's-Gravenhaags ~ |
| 763 | 8 # word that differs between regions ~ |
| 764 | 9 kado/1 ~ |
| 765 | 10 cadeau/2 ~ |
| 766 | 11 TCP,IP ~ |
| 767 | 12 /the S affix may add a 's' ~ |
| 768 | 13 bedel/S ~ |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 769 | |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 770 | The first line contains the number of words. Vim ignores it, but you do get |
| 771 | an error message if it's not there. *E760* |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 772 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 773 | What follows is one word per line. White space at the end of the line is |
| 774 | ignored, all other white space matters. The encoding is specified in the |
| 775 | affix file |spell-SET|. |
| 776 | |
| 777 | Comment lines start with '#' or '/'. See the example lines 8 and 12. Note |
| 778 | that putting a comment after a word is NOT allowed: |
| 779 | |
| 780 | someword # comment that causes an error! ~ |
| 781 | |
| 782 | After the word there is an optional slash and flags. Most of these flags are |
| 783 | letters that indicate the affixes that can be used with this word. These are |
| 784 | specified with SFX and PFX lines in the .aff file, see |spell-SFX| and |
| 785 | |spell-PFX|. Vim allows using other flag types with the FLAG item in the |
| 786 | affix file |spell-FLAG|. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 787 | |
| 788 | When the word only has lower-case letters it will also match with the word |
| 789 | starting with an upper-case letter. |
| 790 | |
| 791 | When the word includes an upper-case letter, this means the upper-case letter |
| 792 | is required at this position. The same word with a lower-case letter at this |
| 793 | position will not match. When some of the other letters are upper-case it will |
| 794 | not match either. |
| 795 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 796 | The word with all upper-case characters will always be OK, |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 797 | |
| 798 | word list matches does not match ~ |
| 799 | als als Als ALS ALs AlS aLs aLS |
| 800 | Als Als ALS als ALs AlS aLs aLS |
| 801 | ALS ALS als Als ALs AlS aLs aLS |
| 802 | AlS AlS ALS als Als ALs aLs aLS |
| 803 | |
Bram Moolenaar | 1cbe5f7 | 2005-12-29 22:51:09 +0000 | [diff] [blame] | 804 | The KEEPCASE affix ID can be used to specifically match a word with identical |
| 805 | case only, see below |spell-KEEPCASE|. |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 806 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 807 | Note: in line 5 to 7 non-word characters are used. You can include any |
| 808 | character in a word. When checking the text a word still only matches when it |
| 809 | appears with a non-word character before and after it. For Myspell a word |
| 810 | starting with a non-word character probably won't work. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 811 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 812 | In line 12 the word "TCP/IP" is defined. Since the slash has a special |
| 813 | meaning the comma is used instead. This is defined with the SLASH item in the |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 814 | affix file, see |spell-SLASH|. Note that without this SLASH item the word |
| 815 | will be "TCP,IP". |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 816 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 817 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 818 | AFFIX FILE FORMAT *spell-aff-format* *spell-affix-vim* |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 819 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 820 | *spell-affix-comment* |
| 821 | Comment lines in the .aff file start with a '#': |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 822 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 823 | # comment line ~ |
| 824 | |
| 825 | With some items it's also possible to put a comment after it, but this isn't |
| 826 | supported in general. |
| 827 | |
| 828 | |
| 829 | ENCODING *spell-SET* |
| 830 | |
| 831 | The affix file can be in any encoding that is supported by "iconv". However, |
| 832 | in some cases the current locale should also be set properly at the time |
| 833 | |:mkspell| is invoked. Adding FOL/LOW/UPP lines removes this requirement |
| 834 | |spell-FOL|. |
| 835 | |
| 836 | The encoding should be specified before anything where the encoding matters. |
| 837 | The encoding applies both to the affix file and the dictionary file. It is |
| 838 | done with a SET line: |
| 839 | |
| 840 | SET utf-8 ~ |
| 841 | |
| 842 | The encoding can be different from the value of the 'encoding' option at the |
| 843 | time ":mkspell" is used. Vim will then convert everything to 'encoding' and |
| 844 | generate a spell file for 'encoding'. If some of the used characters to not |
| 845 | fit in 'encoding' you will get an error message. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 846 | *spell-affix-mbyte* |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 847 | When using a multi-byte encoding it's possible to use more different affix |
| 848 | flags. But Myspell doesn't support that, thus you may not want to use it |
| 849 | anyway. For compatibility use an 8-bit encoding. |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 850 | |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 851 | |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 852 | INFORMATION |
| 853 | |
| 854 | These entries in the affix file can be used to add information to the spell |
| 855 | file. There are no restrictions on the format, but they should be in the |
| 856 | right encoding. |
| 857 | |
| 858 | *spell-NAME* *spell-VERSION* *spell-HOME* |
| 859 | *spell-AUTHOR* *spell-EMAIL* *spell-COPYRIGHT* |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 860 | NAME Name of the language |
| 861 | VERSION 1.0.1 with fixes |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 862 | HOME http://www.myhome.eu |
| 863 | AUTHOR John Doe |
| 864 | EMAIL john AT Doe DOT net |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 865 | COPYRIGHT LGPL |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 866 | |
| 867 | These fields are put in the .spl file as-is. The |:spellinfo| command can be |
| 868 | used to view the info. |
| 869 | |
| 870 | *:spellinfo* *:spelli* |
| 871 | :spelli[nfo] Display the information for the spell file(s) used for |
| 872 | the current buffer. |
| 873 | |
| 874 | |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 875 | CHARACTER TABLES |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 876 | *spell-affix-chars* |
Bram Moolenaar | 82cf9b6 | 2005-06-07 21:09:25 +0000 | [diff] [blame] | 877 | When using an 8-bit encoding the affix file should define what characters are |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 878 | word characters. This is because the system where ":mkspell" is used may not |
| 879 | support a locale with this encoding and isalpha() won't work. For example |
| 880 | when using "cp1250" on Unix. |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 881 | *E761* *E762* *spell-FOL* |
| 882 | *spell-LOW* *spell-UPP* |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 883 | Three lines in the affix file are needed. Simplistic example: |
| 884 | |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 885 | FOL áëñ ~ |
| 886 | LOW áëñ ~ |
| 887 | UPP ÁËÑ ~ |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 888 | |
| 889 | All three lines must have exactly the same number of characters. |
| 890 | |
| 891 | The "FOL" line specifies the case-folded characters. These are used to |
| 892 | compare words while ignoring case. For most encodings this is identical to |
| 893 | the lower case line. |
| 894 | |
| 895 | The "LOW" line specifies the characters in lower-case. Mostly it's equal to |
| 896 | the "FOL" line. |
| 897 | |
| 898 | The "UPP" line specifies the characters with upper-case. That is, a character |
| 899 | is upper-case where it's different from the character at the same position in |
| 900 | "FOL". |
| 901 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 902 | An exception is made for the German sharp s ß. The upper-case version is |
| 903 | "SS". In the FOL/LOW/UPP lines it should be included, so that it's recognized |
| 904 | as a word character, but use the ß character in all three. |
| 905 | |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 906 | ASCII characters should be omitted, Vim always handles these in the same way. |
| 907 | When the encoding is UTF-8 no word characters need to be specified. |
| 908 | |
| 909 | *E763* |
Bram Moolenaar | 3b50694 | 2005-06-23 22:36:45 +0000 | [diff] [blame] | 910 | Vim allows you to use spell checking for several languages in the same file. |
| 911 | You can list them in the 'spelllang' option. As a consequence all spell files |
| 912 | for the same encoding must use the same word characters, otherwise they can't |
| 913 | be combined without errors. If you get a warning that the word tables differ |
| 914 | you may need to generate the .spl file again with |:mkspell|. Check the FOL, |
| 915 | LOW and UPP lines in the used .aff file. |
| 916 | |
| 917 | The XX.ascii.spl spell file generated with the "-ascii" argument will not |
| 918 | contain the table with characters, so that it can be combine with spell files |
| 919 | 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] | 920 | |
Bram Moolenaar | e756604 | 2005-06-17 22:00:15 +0000 | [diff] [blame] | 921 | |
Bram Moolenaar | 9a50b1b | 2005-06-27 22:48:21 +0000 | [diff] [blame] | 922 | MID-WORD CHARACTERS |
| 923 | *spell-midword* |
| 924 | Some characters are only to be considered word characters if they are used in |
| 925 | between two ordinary word characters. An example is the single quote: It is |
| 926 | often used to put text in quotes, thus it can't be recognized as a word |
| 927 | character, but when it appears in between word characters it must be part of |
| 928 | the word. This is needed to detect a spelling error such as they'are. That |
| 929 | should be they're, but since "they" and "are" are words themselves that would |
| 930 | go unnoticed. |
| 931 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 932 | These characters are defined with MIDWORD in the .aff file. Example: |
Bram Moolenaar | 9a50b1b | 2005-06-27 22:48:21 +0000 | [diff] [blame] | 933 | |
| 934 | MIDWORD '- ~ |
| 935 | |
| 936 | |
Bram Moolenaar | 6e7c7f3 | 2005-08-24 22:16:11 +0000 | [diff] [blame] | 937 | FLAG TYPES *spell-FLAG* |
| 938 | |
| 939 | Flags are used to specify the affixes that can be used with a word and for |
| 940 | other properties of the word. Normally single-character flags are used. This |
| 941 | limits the number of possible flags, especially for 8-bit encodings. The FLAG |
| 942 | item can be used if more affixes are to be used. Possible values: |
| 943 | |
| 944 | FLAG long use two-character flags |
| 945 | FLAG num use numbers, from 1 up to 65000 |
Bram Moolenaar | 81f1ecb | 2005-08-25 21:27:31 +0000 | [diff] [blame] | 946 | FLAG caplong use one-character flags without A-Z and two-character |
Bram Moolenaar | 6e7c7f3 | 2005-08-24 22:16:11 +0000 | [diff] [blame] | 947 | flags that start with A-Z |
| 948 | |
| 949 | With "FLAG num" the numbers in a list of affixes need to be separated with a |
| 950 | comma: "234,2143,1435". This method is inefficient, but useful if the file is |
| 951 | generated with a program. |
| 952 | |
Bram Moolenaar | 81f1ecb | 2005-08-25 21:27:31 +0000 | [diff] [blame] | 953 | When using "caplong" the two-character flags all start with a capital: "Aa", |
| 954 | "B1", "BB", etc. This is useful to use one-character flags for the most |
| 955 | common items and two-character flags for uncommon items. |
Bram Moolenaar | 6e7c7f3 | 2005-08-24 22:16:11 +0000 | [diff] [blame] | 956 | |
| 957 | Note: When using utf-8 only characters up to 65000 may be used for flags. |
| 958 | |
| 959 | |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 960 | AFFIXES |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 961 | *spell-PFX* *spell-SFX* |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 962 | 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] | 963 | documentation or the Aspell manual: |
| 964 | http://aspell.net/man-html/Affix-Compression.html). |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 965 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 966 | Summary: |
| 967 | SFX L Y 2 ~ |
| 968 | SFX L 0 re [^x] ~ |
| 969 | SFX L 0 ro x ~ |
| 970 | |
| 971 | The first line is a header and has four fields: |
| 972 | SFX {flag} {combine} {count} |
| 973 | |
| 974 | {flag} The name used for the suffix. Mostly it's a single letter, |
| 975 | but other characters can be used, see |spell-FLAG|. |
| 976 | |
| 977 | {combine} Can be 'Y' or 'N'. When 'Y' then the word plus suffix can |
| 978 | also have a prefix. When 'N' then a prefix is not allowed. |
| 979 | |
| 980 | {count} The number of lines following. If this is wrong you will get |
| 981 | an error message. |
| 982 | |
| 983 | For PFX the fields are exactly the same. |
| 984 | |
| 985 | The basic format for the following lines is: |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 986 | SFX {flag} {strip} {add} {condition} {extra} |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 987 | |
| 988 | {flag} Must be the same as the {flag} used in the first line. |
| 989 | |
| 990 | {strip} Characters removed from the basic word. There is no check if |
| 991 | the characters are actually there, only the length is used (in |
| 992 | bytes). This better match the {condition}, otherwise strange |
| 993 | things may happen. If the {strip} length is equal to or |
| 994 | longer than the basic word the suffix won't be used. |
| 995 | When {strip} is 0 (zero) then nothing is stripped. |
| 996 | |
| 997 | {add} Characters added to the basic word, after removing {strip}. |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 998 | Optionally there is a '/' followed by flags. The flags apply |
| 999 | to the word plus affix. See |spell-affix-flags| |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1000 | |
| 1001 | {condition} A simplistic pattern. Only when this matches with a basic |
| 1002 | word will the suffix be used for that word. This is normally |
| 1003 | for using one suffix letter with different {add} and {strip} |
| 1004 | fields for words with different endings. |
| 1005 | When {condition} is a . (dot) there is no condition. |
| 1006 | The pattern may contain: |
| 1007 | - Literal characters. |
| 1008 | - A set of characters in []. [abc] matches a, b and c. |
| 1009 | A dash is allowed for a range [a-c], but this is |
| 1010 | Vim-specific. |
| 1011 | - A set of characters that starts with a ^, meaning the |
| 1012 | complement of the specified characters. [^abc] matches any |
| 1013 | character but a, b and c. |
| 1014 | |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1015 | {extra} Optional extra text: |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1016 | # comment Comment is ignored |
| 1017 | - Hunspell uses this, ignored |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1018 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1019 | For PFX the fields are the same, but the {strip}, {add} and {condition} apply |
| 1020 | to the start of the word. |
| 1021 | |
| 1022 | Note: Myspell ignores any extra text after the relevant info. Vim requires |
| 1023 | this text to start with a "#" so that mistakes don't go unnoticed. Example: |
Bram Moolenaar | 9a50b1b | 2005-06-27 22:48:21 +0000 | [diff] [blame] | 1024 | |
| 1025 | SFX F 0 in [^i]n # Spion > Spionin ~ |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 1026 | SFX F 0 nen in # Bauerin > Bauerinnen ~ |
Bram Moolenaar | 9a50b1b | 2005-06-27 22:48:21 +0000 | [diff] [blame] | 1027 | |
Bram Moolenaar | 81f1ecb | 2005-08-25 21:27:31 +0000 | [diff] [blame] | 1028 | Apparently Myspell allows an affix name to appear more than once. Since this |
| 1029 | might also be a mistake, Vim checks for an extra "S". The affix files for |
| 1030 | Myspell that use this feature apparently have this flag. Example: |
| 1031 | |
| 1032 | SFX a Y 1 S ~ |
| 1033 | SFX a 0 an . ~ |
| 1034 | |
| 1035 | SFX a Y 2 S ~ |
| 1036 | SFX a 0 en . ~ |
| 1037 | SFX a 0 on . ~ |
| 1038 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1039 | |
| 1040 | AFFIX FLAGS *spell-affix-flags* |
| 1041 | |
| 1042 | This is a feature that comes from Hunspell: The affix may specify flags. This |
| 1043 | works similar to flags specified on a basic word. The flags apply to the |
Bram Moolenaar | 8dff818 | 2006-04-06 20:18:50 +0000 | [diff] [blame] | 1044 | basic word plus the affix (but there are restrictions). Example: |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1045 | |
| 1046 | SFX S Y 1 ~ |
| 1047 | SFX S 0 s . ~ |
| 1048 | |
| 1049 | SFX A Y 1 ~ |
| 1050 | SFX A 0 able/S . ~ |
| 1051 | |
| 1052 | When the dictionary file contains "drink/AS" then these words are possible: |
| 1053 | |
| 1054 | drink |
| 1055 | drinks uses S suffix |
| 1056 | drinkable uses A suffix |
| 1057 | drinkables uses A suffix and then S suffix |
| 1058 | |
| 1059 | Generally the flags of the suffix are added to the flags of the basic word, |
| 1060 | both are used for the word plus suffix. But the flags of the basic word are |
| 1061 | only used once for affixes, except that both one prefix and one suffix can be |
| 1062 | used when both support combining. |
| 1063 | |
| 1064 | Specifically, the affix flags can be used for: |
Bram Moolenaar | 8dff818 | 2006-04-06 20:18:50 +0000 | [diff] [blame] | 1065 | - Suffixes on suffixes, as in the example above. This works once, thus you |
| 1066 | can have two suffixes on a word (plus one prefix). |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1067 | - Making the word with the affix rare, by using the |spell-RARE| flag. |
| 1068 | - Exclude the word with the affix from compounding, by using the |
| 1069 | |spell-COMPOUNDFORBIDFLAG| flag. |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 1070 | - Allow the word with the affix to be part of a compound word on the side of |
| 1071 | the affix with the |spell-COMPOUNDPERMITFLAG|. |
Bram Moolenaar | 8dff818 | 2006-04-06 20:18:50 +0000 | [diff] [blame] | 1072 | - Use the NEEDCOMPOUND flag: word plus affix can only be used as part of a |
| 1073 | compound word. |spell-NEEDCOMPOUND| |
| 1074 | - Compound flags: word plus affix can be part of a compound word at the end, |
| 1075 | middle, start, etc. The flags are combined with the flags of the basic |
| 1076 | word. |spell-compound| |
| 1077 | - NEEDAFFIX: another affix is needed to make a valid word. |
| 1078 | - CIRCUMFIX, as explained just below. |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1079 | |
Bram Moolenaar | 8dff818 | 2006-04-06 20:18:50 +0000 | [diff] [blame] | 1080 | |
| 1081 | CIRCUMFIX *spell-CIRCUMFIX* |
| 1082 | |
| 1083 | The CIRCUMFIX flag means a prefix and suffix must be added at the same time. |
| 1084 | If a prefix has the CIRCUMFIX flag than only suffixes with the CIRCUMFIX flag |
| 1085 | can be added, and the other way around. |
| 1086 | An alternative is to only specify the suffix, and give the that suffix two |
| 1087 | flags: The required prefix and the NEEDAFFIX flag. |spell-NEEDAFFIX| |
| 1088 | |
| 1089 | |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 1090 | PFXPOSTPONE *spell-PFXPOSTPONE* |
Bram Moolenaar | 8dff818 | 2006-04-06 20:18:50 +0000 | [diff] [blame] | 1091 | |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 1092 | When an affix file has very many prefixes that apply to many words it's not |
| 1093 | possible to build the whole word list in memory. This applies to Hebrew (a |
| 1094 | list with all words is over a Gbyte). In that case applying prefixes must be |
| 1095 | postponed. This makes spell checking slower. It is indicated by this keyword |
| 1096 | in the .aff file: |
| 1097 | |
| 1098 | PFXPOSTPONE ~ |
| 1099 | |
Bram Moolenaar | 8dff818 | 2006-04-06 20:18:50 +0000 | [diff] [blame] | 1100 | Only prefixes without a chop string and without flags can be postponed. |
| 1101 | Prefixes with a chop string or with flags will still be included in the word |
| 1102 | list. An exception if the chop string is one character and equal to the last |
| 1103 | character of the added string, but in lower case. Thus when the chop string |
| 1104 | is used to allow the following word to start with an upper case letter. |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 1105 | |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1106 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1107 | WORDS WITH A SLASH *spell-SLASH* |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1108 | |
| 1109 | The slash is used in the .dic file to separate the basic word from the affix |
Bram Moolenaar | 33aec76 | 2006-01-22 23:30:12 +0000 | [diff] [blame] | 1110 | letters and other flags. Unfortunately, this means you cannot use a slash in |
| 1111 | a word. Thus "TCP/IP" is not a word but "TCP with the flags "IP". To include |
| 1112 | a slash in the word put a backslash before it: "TCP\/IP". In the rare case |
| 1113 | you want to use a backslash inside a word you need to use two backslashes. |
| 1114 | Any other use of the backslash is reserved for future expansion. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1115 | |
| 1116 | |
Bram Moolenaar | 1cbe5f7 | 2005-12-29 22:51:09 +0000 | [diff] [blame] | 1117 | KEEP-CASE WORDS *spell-KEEPCASE* |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1118 | |
Bram Moolenaar | 1cbe5f7 | 2005-12-29 22:51:09 +0000 | [diff] [blame] | 1119 | In the affix file a KEEPCASE line can be used to define the affix name used |
| 1120 | for keep-case words. Example: |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 1121 | |
Bram Moolenaar | 1cbe5f7 | 2005-12-29 22:51:09 +0000 | [diff] [blame] | 1122 | KEEPCASE = ~ |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 1123 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1124 | This flag is not supported by Myspell. It has the meaning that case matters. |
| 1125 | This can be used if the word does not have the first letter in upper case at |
| 1126 | the start of a sentence. Example: |
| 1127 | |
| 1128 | word list matches does not match ~ |
| 1129 | 's morgens/= 's morgens 'S morgens 's Morgens 'S MORGENS |
| 1130 | 's Morgens 's Morgens 'S MORGENS 'S morgens 's morgens |
| 1131 | |
| 1132 | The flag can also be used to avoid that the word matches when it is in all |
| 1133 | upper-case letters. |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 1134 | |
Bram Moolenaar | e13305e | 2005-06-19 22:54:15 +0000 | [diff] [blame] | 1135 | |
Bram Moolenaar | 1cbe5f7 | 2005-12-29 22:51:09 +0000 | [diff] [blame] | 1136 | RARE WORDS *spell-RARE* |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1137 | |
Bram Moolenaar | 1cbe5f7 | 2005-12-29 22:51:09 +0000 | [diff] [blame] | 1138 | In the affix file a RARE line can be used to define the affix name used for |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 1139 | rare words. Example: |
| 1140 | |
Bram Moolenaar | 1cbe5f7 | 2005-12-29 22:51:09 +0000 | [diff] [blame] | 1141 | RARE ? ~ |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 1142 | |
| 1143 | Rare words are highlighted differently from bad words. This is to be used for |
| 1144 | 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] | 1145 | a typing mistake anyway. When the same word is found as good it won't be |
| 1146 | highlighted as rare. |
| 1147 | |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 1148 | This flag can also be used on an affix, so that a basic word is not rare but |
| 1149 | the basic word plus affix is rare |spell-affix-flags|. However, if the word |
| 1150 | also appears as a good word in another way (e.g., in another region) it won't |
| 1151 | be marked as rare. |
| 1152 | |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 1153 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1154 | BAD WORDS *spell-BAD* |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1155 | |
Bram Moolenaar | 30abd28 | 2005-06-22 22:35:10 +0000 | [diff] [blame] | 1156 | In the affix file a BAD line can be used to define the affix name used for |
| 1157 | bad words. Example: |
| 1158 | |
| 1159 | BAD ! ~ |
| 1160 | |
| 1161 | 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] | 1162 | "the the" in the .dic file: |
| 1163 | |
| 1164 | the the/! ~ |
| 1165 | |
| 1166 | Once a word has been marked as bad it won't be undone by encountering the same |
| 1167 | word as good. |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 1168 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1169 | The flag also applies to the word with affixes, thus this can be used to mark |
| 1170 | a whole bunch of related words as bad. |
| 1171 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1172 | *spell-NEEDAFFIX* |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1173 | The NEEDAFFIX flag is used to require that a word is used with an affix. The |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1174 | word itself is not a good word (unless there is an empty affix). Example: |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1175 | |
| 1176 | NEEDAFFIX + ~ |
| 1177 | |
Bram Moolenaar | 45eeb13 | 2005-06-06 21:59:07 +0000 | [diff] [blame] | 1178 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1179 | COMPOUND WORDS *spell-compound* |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1180 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1181 | A compound word is a longer word made by concatenating words that appear in |
| 1182 | the .dic file. To specify which words may be concatenated a character is |
| 1183 | used. This character is put in the list of affixes after the word. We will |
| 1184 | call this character a flag here. Obviously these flags must be different from |
| 1185 | any affix IDs used. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1186 | |
| 1187 | *spell-COMPOUNDFLAG* |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1188 | The Myspell compatible method uses one flag, specified with COMPOUNDFLAG. All |
| 1189 | words with this flag combine in any order. This means there is no control |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1190 | over which word comes first. Example: |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1191 | COMPOUNDFLAG c ~ |
| 1192 | |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1193 | *spell-COMPOUNDRULE* |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1194 | A more advanced method to specify how compound words can be formed uses |
| 1195 | multiple items with multiple flags. This is not compatible with Myspell 3.0. |
| 1196 | Let's start with an example: |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1197 | COMPOUNDRULE c+ ~ |
| 1198 | COMPOUNDRULE se ~ |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1199 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1200 | The first line defines that words with the "c" flag can be concatenated in any |
| 1201 | order. The second line defines compound words that are made of one word with |
| 1202 | the "s" flag and one word with the "e" flag. With this dictionary: |
| 1203 | bork/c ~ |
| 1204 | onion/s ~ |
| 1205 | soup/e ~ |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1206 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1207 | You can make these words: |
| 1208 | bork |
| 1209 | borkbork |
| 1210 | borkborkbork |
| 1211 | (etc.) |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1212 | onion |
| 1213 | soup |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1214 | onionsoup |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1215 | |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1216 | The COMPOUNDRULE item may appear multiple times. The argument is made out of |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1217 | one or more groups, where each group can be: |
| 1218 | one flag e.g., c |
| 1219 | alternate flags inside [] e.g., [abc] |
| 1220 | Optionally this may be followed by: |
| 1221 | * the group appears zero or more times, e.g., sm*e |
| 1222 | + the group appears one or more times, e.g., c+ |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1223 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1224 | This is similar to the regexp pattern syntax (but not the same!). A few |
| 1225 | examples with the sequence of word flags they require: |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1226 | COMPOUNDRULE x+ x xx xxx etc. |
| 1227 | COMPOUNDRULE yz yz |
| 1228 | COMPOUNDRULE x+z xz xxz xxxz etc. |
| 1229 | COMPOUNDRULE yx+ yx yxx yxxx etc. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1230 | |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1231 | COMPOUNDRULE [abc]z az bz cz |
| 1232 | COMPOUNDRULE [abc]+z az aaz abaz bz baz bcbz cz caz cbaz etc. |
| 1233 | COMPOUNDRULE a[xyz]+ ax axx axyz ay ayx ayzz az azy azxy etc. |
| 1234 | COMPOUNDRULE sm*e se sme smme smmme etc. |
| 1235 | COMPOUNDRULE 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] | 1236 | |
Bram Moolenaar | a6c840d | 2005-08-22 22:59:46 +0000 | [diff] [blame] | 1237 | A specific example: Allow a compound to be made of two words and a dash: |
| 1238 | In the .aff file: |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1239 | COMPOUNDRULE sde ~ |
Bram Moolenaar | a6c840d | 2005-08-22 22:59:46 +0000 | [diff] [blame] | 1240 | NEEDAFFIX x ~ |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1241 | COMPOUNDWORDMAX 3 ~ |
Bram Moolenaar | a6c840d | 2005-08-22 22:59:46 +0000 | [diff] [blame] | 1242 | COMPOUNDMIN 1 ~ |
| 1243 | In the .dic file: |
| 1244 | start/s ~ |
| 1245 | end/e ~ |
| 1246 | -/xd ~ |
| 1247 | |
| 1248 | This allows for the word "start-end", but not "startend". |
| 1249 | |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 1250 | An additional implied rule is that, without further flags, a word with a |
| 1251 | prefix cannot be compounded after another word, and a word with a suffix |
| 1252 | cannot be compounded with a following word. Thus the affix cannot appear |
| 1253 | on the inside of a compound word. This can be changed with the |
| 1254 | |spell-COMPOUNDPERMITFLAG|. |
| 1255 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1256 | *spell-NEEDCOMPOUND* |
| 1257 | The NEEDCOMPOUND flag is used to require that a word is used as part of a |
| 1258 | compound word. The word itself is not a good word. Example: |
| 1259 | |
| 1260 | NEEDCOMPOUND & ~ |
| 1261 | |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1262 | *spell-COMPOUNDMIN* |
Bram Moolenaar | ac6e65f | 2005-08-29 22:25:38 +0000 | [diff] [blame] | 1263 | 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] | 1264 | COMPOUNDMIN. Example: |
| 1265 | COMPOUNDMIN 5 ~ |
| 1266 | |
Bram Moolenaar | ac6e65f | 2005-08-29 22:25:38 +0000 | [diff] [blame] | 1267 | When omitted there is no minimal length. Obviously you could just leave out |
| 1268 | the compound flag from short words instead, this feature is present for |
| 1269 | compatibility with Myspell. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1270 | |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1271 | *spell-COMPOUNDWORDMAX* |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1272 | The maximum number of words that can be concatenated into a compound word is |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1273 | specified with COMPOUNDWORDMAX. Example: |
| 1274 | COMPOUNDWORDMAX 3 ~ |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1275 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1276 | When omitted there is no maximum. It applies to all compound words. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1277 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1278 | To set a limit for words with specific flags make sure the items in |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1279 | COMPOUNDRULE where they appear don't allow too many words. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1280 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1281 | *spell-COMPOUNDSYLMAX* |
| 1282 | The maximum number of syllables that a compound word may contain is specified |
| 1283 | with COMPOUNDSYLMAX. Example: |
| 1284 | COMPOUNDSYLMAX 6 ~ |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1285 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1286 | This has no effect if there is no SYLLABLE item. Without COMPOUNDSYLMAX there |
| 1287 | is no limit on the number of syllables. |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1288 | |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1289 | If both COMPOUNDWORDMAX and COMPOUNDSYLMAX are defined, a compound word is |
Bram Moolenaar | a6c840d | 2005-08-22 22:59:46 +0000 | [diff] [blame] | 1290 | accepted if it fits one of the criteria, thus is either made from up to |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1291 | COMPOUNDWORDMAX words or contains up to COMPOUNDSYLMAX syllables. |
Bram Moolenaar | a6c840d | 2005-08-22 22:59:46 +0000 | [diff] [blame] | 1292 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1293 | *spell-COMPOUNDFORBIDFLAG* |
| 1294 | The COMPOUNDFORBIDFLAG specifies a flag that can be used on an affix. It |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 1295 | means that the word plus affix cannot be used in a compound word. Example: |
| 1296 | affix file: |
| 1297 | COMPOUNDFLAG c ~ |
| 1298 | COMPOUNDFORBIDFLAG x ~ |
| 1299 | SFX a Y 2 ~ |
| 1300 | SFX a 0 s . ~ |
| 1301 | SFX a 0 ize/x . ~ |
| 1302 | dictionary: |
| 1303 | word/c ~ |
| 1304 | util/ac ~ |
| 1305 | |
| 1306 | This allows for "wordutil" and "wordutils" but not "wordutilize". |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 1307 | Note: this doesn't work for postponed prefixes yet. |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1308 | |
| 1309 | *spell-COMPOUNDPERMITFLAG* |
| 1310 | The COMPOUNDPERMITFLAG specifies a flag that can be used on an affix. It |
| 1311 | means that the word plus affix can also be used in a compound word in a way |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 1312 | where the affix ends up halfway the word. Without this flag that is not |
| 1313 | allowed. |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 1314 | Note: this doesn't work for postponed prefixes yet. |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1315 | |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1316 | *spell-COMPOUNDROOT* |
| 1317 | The COMPOUNDROOT flag is used for words in the dictionary that are already a |
| 1318 | compound. This means it counts for two words when checking the compounding |
| 1319 | rules. Can also be used for an affix to count the affix as a compounding |
| 1320 | word. |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1321 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1322 | *spell-SYLLABLE* |
| 1323 | The SYLLABLE item defines characters or character sequences that are used to |
| 1324 | count the number of syllables in a word. Example: |
| 1325 | 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] | 1326 | |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1327 | Before the first slash is the set of characters that are counted for one |
| 1328 | syllable, also when repeated and mixed, until the next character that is not |
| 1329 | in this set. After the slash come sequences of characters that are counted |
| 1330 | for one syllable. These are preferred over using characters from the set. |
| 1331 | With the example "ideeen" has three syllables, counted by "i", "ee" and "e". |
| 1332 | |
| 1333 | Only case-folded letters need to be included. |
| 1334 | |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 1335 | Above another way to restrict compounding was mentioned above: Adding the |
| 1336 | |spell-COMPOUNDFORBIDFLAG| flag to an affix causes all words that are made |
| 1337 | with that affix not be be used for compounding. |
Bram Moolenaar | 8aff23a | 2005-08-19 20:40:30 +0000 | [diff] [blame] | 1338 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1339 | |
| 1340 | UNLIMITED COMPOUNDING *spell-NOBREAK* |
| 1341 | |
| 1342 | For some languages, such as Thai, there is no space in between words. This |
| 1343 | looks like all words are compounded. To specify this use the NOBREAK item in |
| 1344 | the affix file, without arguments: |
| 1345 | NOBREAK ~ |
| 1346 | |
| 1347 | Vim will try to figure out where one word ends and a next starts. When there |
| 1348 | are spelling mistakes this may not be quite right. |
| 1349 | |
Bram Moolenaar | ae5bce1 | 2005-08-15 21:41:48 +0000 | [diff] [blame] | 1350 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1351 | *spell-COMMON* |
| 1352 | Common words can be specified with the COMMON item. This will give better |
| 1353 | suggestions when editing a short file. Example: |
| 1354 | |
| 1355 | COMMON the of to and a in is it you that he was for on are ~ |
| 1356 | |
| 1357 | The words must be separated by white space, up to 25 per line. |
| 1358 | When multiple regions are specified in a ":mkspell" command the common words |
| 1359 | for all regions are combined and used for all regions. |
| 1360 | |
| 1361 | *spell-NOSPLITSUGS* |
Bram Moolenaar | fd2ac76 | 2006-03-01 22:09:21 +0000 | [diff] [blame] | 1362 | This item indicates that splitting a word to make suggestions is not a good |
| 1363 | idea. Split-word suggestions will appear only when there are few similar |
| 1364 | words. |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1365 | |
| 1366 | NOSPLITSUGS ~ |
| 1367 | |
| 1368 | *spell-NOSUGGEST* |
| 1369 | The flag specified with NOSUGGEST can be used for words that will not be |
| 1370 | suggested. Can be used for obscene words. |
| 1371 | |
| 1372 | NOSUGGEST % ~ |
| 1373 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1374 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1375 | REPLACEMENTS *spell-REP* |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1376 | |
| 1377 | In the affix file REP items can be used to define common mistakes. This is |
| 1378 | used to make spelling suggestions. The items define the "from" text and the |
| 1379 | "to" replacement. Example: |
| 1380 | |
| 1381 | REP 4 ~ |
| 1382 | REP f ph ~ |
| 1383 | REP ph f ~ |
| 1384 | REP k ch ~ |
| 1385 | REP ch k ~ |
| 1386 | |
Bram Moolenaar | 6e7c7f3 | 2005-08-24 22:16:11 +0000 | [diff] [blame] | 1387 | The first line specifies the number of REP lines following. Vim ignores the |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1388 | number, but it must be there (for compatibility with Myspell). |
Bram Moolenaar | 6e7c7f3 | 2005-08-24 22:16:11 +0000 | [diff] [blame] | 1389 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 1390 | Don't include simple one-character replacements or swaps. Vim will try these |
| 1391 | anyway. You can include whole words if you want to, but you might want to use |
| 1392 | the "file:" item in 'spellsuggest' instead. |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1393 | |
Bram Moolenaar | 1e01546 | 2005-09-25 22:16:38 +0000 | [diff] [blame] | 1394 | You can include a space by using an underscore: |
| 1395 | |
| 1396 | REP the_the the ~ |
| 1397 | |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1398 | |
Bram Moolenaar | a40ceaf | 2006-01-13 22:35:40 +0000 | [diff] [blame] | 1399 | SIMILAR CHARACTERS *spell-MAP* *E783* |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1400 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 1401 | 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] | 1402 | alike. This is mostly used for a letter with different accents. This is used |
| 1403 | to prefer suggestions with these letters substituted. Example: |
| 1404 | |
| 1405 | MAP 2 ~ |
| 1406 | MAP eéëêè ~ |
| 1407 | MAP uüùúû ~ |
| 1408 | |
Bram Moolenaar | 6e7c7f3 | 2005-08-24 22:16:11 +0000 | [diff] [blame] | 1409 | The first line specifies the number of MAP lines following. Vim ignores the |
| 1410 | number, but the line must be there. |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1411 | |
Bram Moolenaar | d042c56 | 2005-06-30 22:04:15 +0000 | [diff] [blame] | 1412 | Each letter must appear in only one of the MAP items. It's a bit more |
| 1413 | 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] | 1414 | |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1415 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1416 | .SUG FILE *spell-NOSUGFILE* |
| 1417 | |
| 1418 | When soundfolding is specified in the affix file then ":mkspell" will normally |
Bram Moolenaar | d12f5c1 | 2006-01-25 22:10:52 +0000 | [diff] [blame] | 1419 | produce a .sug file next to the .spl file. This file is used to find |
| 1420 | suggestions by their sound-a-like form quickly. At the cost of a lot of |
| 1421 | memory (the amount depends on the number of words, |:mkspell| will display an |
| 1422 | estimate when it's done). |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1423 | |
| 1424 | To avoid producing a .sug file use this item in the affix file: |
| 1425 | |
| 1426 | NOSUGFILE ~ |
| 1427 | |
Bram Moolenaar | d12f5c1 | 2006-01-25 22:10:52 +0000 | [diff] [blame] | 1428 | Users can simply omit the .sug file if they don't want to use it. |
| 1429 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1430 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1431 | SOUND-A-LIKE *spell-SAL* |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1432 | |
| 1433 | In the affix file SAL items can be used to define the sounds-a-like mechanism |
| 1434 | 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] | 1435 | Simplistic example: |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1436 | |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 1437 | SAL CIA X ~ |
| 1438 | SAL CH X ~ |
| 1439 | SAL C K ~ |
| 1440 | SAL K K ~ |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1441 | |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 1442 | 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] | 1443 | how it works can be found in the Aspell manual: |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 1444 | http://aspell.net/man-html/Phonetic-Code.html. |
Bram Moolenaar | 9ba0eb8 | 2005-06-13 22:28:56 +0000 | [diff] [blame] | 1445 | |
| 1446 | There are a few special items: |
| 1447 | |
| 1448 | SAL followup true ~ |
| 1449 | SAL collapse_result true ~ |
| 1450 | SAL remove_accents true ~ |
| 1451 | |
| 1452 | "1" has the same meaning as "true". Any other value means "false". |
| 1453 | |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 1454 | |
Bram Moolenaar | 6f16eb8 | 2005-08-23 21:02:42 +0000 | [diff] [blame] | 1455 | SIMPLE SOUNDFOLDING *spell-SOFOFROM* *spell-SOFOTO* |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 1456 | |
| 1457 | The SAL mechanism is complex and slow. A simpler mechanism is mapping all |
| 1458 | characters to another character, mapping similar sounding characters to the |
| 1459 | 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] | 1460 | both SAL items and simple soundfolding. |
Bram Moolenaar | 42eeac3 | 2005-06-29 22:40:58 +0000 | [diff] [blame] | 1461 | |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 1462 | 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] | 1463 | and one that specifies the characters they are mapped to. They must have |
| 1464 | exactly the same number of characters. Example: |
| 1465 | |
| 1466 | SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ~ |
| 1467 | SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkes ~ |
| 1468 | |
| 1469 | 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] | 1470 | method would be to leave out all vowels. Some characters that sound nearly |
| 1471 | the same and are often mixed up, such as 'm' and 'n', are mapped to the same |
| 1472 | 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] | 1473 | |
| 1474 | Characters that do not appear in SOFOFROM will be left out, except that all |
| 1475 | white space is replaced by one space. Sequences of the same character in |
| 1476 | SOFOFROM are replaced by one. |
| 1477 | |
| 1478 | 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] | 1479 | '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] | 1480 | |
| 1481 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1482 | UNSUPPORTED ITEMS *spell-affix-not-supported* |
| 1483 | |
| 1484 | These items appear in the affix file of other spell checkers. In Vim they are |
| 1485 | ignored, not supported or defined in another way. |
| 1486 | |
| 1487 | ACCENT (Hunspell) *spell-ACCENT* |
| 1488 | Use MAP instead. |spell-MAP| |
| 1489 | |
| 1490 | CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE* |
| 1491 | Disallow uppercase letters at compound word boundaries. |
| 1492 | Not supported. |
| 1493 | |
| 1494 | CHECKCOMPOUNDDUP (Hunspell) *spell-CHECKCOMPOUNDDUP* |
| 1495 | Disallow using the same word twice in a compound. Not |
| 1496 | supported. |
| 1497 | |
| 1498 | CHECKCOMPOUNDREP (Hunspell) *spell-CHECKCOMPOUNDREP* |
| 1499 | Something about using REP items and compound words. Not |
| 1500 | supported. |
| 1501 | |
| 1502 | CHECKCOMPOUNDTRIPLE (Hunspell) *spell-CHECKCOMPOUNDTRIPLE* |
| 1503 | Forbid three identical characters when compounding. Not |
| 1504 | supported. |
| 1505 | |
| 1506 | CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN* |
| 1507 | Forbid compounding when patterns match. Not supported. |
| 1508 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1509 | COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES* |
| 1510 | Enables using two prefixes. Not supported. |
| 1511 | |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1512 | COMPOUND (Hunspell) *spell-COMPOUND* |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 1513 | This is one line with the count of COMPOUND items, followd by |
| 1514 | that many COMPOUND lines with a pattern. |
| 1515 | Remove the first line with the count and rename the other |
| 1516 | items to COMPOUNDRULE |spell-COMPOUNDRULE| |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1517 | |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1518 | COMPOUNDFIRST (Hunspell) *spell-COMPOUNDFIRST* |
| 1519 | Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| |
| 1520 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1521 | COMPOUNDBEGIN (Hunspell) *spell-COMPOUNDBEGIN* |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1522 | Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1523 | |
| 1524 | COMPOUNDEND (Hunspell) *spell-COMPOUNDEND* |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1525 | Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1526 | |
| 1527 | COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE* |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 1528 | Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1529 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1530 | COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE* |
| 1531 | Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE| |
| 1532 | |spell-COMPOUNDSYLMAX| |
| 1533 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1534 | FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD* |
| 1535 | Use BAD instead. |spell-BAD| |
| 1536 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1537 | LANG (Hunspell) *spell-LANG* |
| 1538 | This specifies language-specific behavior. This actually |
| 1539 | moves part of the language knowledge into the program, |
| 1540 | therefore Vim does not support it. Each language property |
| 1541 | must be specified separately. |
| 1542 | |
| 1543 | LEMMA_PRESENT (Hunspell) *spell-LEMMA_PRESENT* |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 1544 | Only needed for morphological analysis. |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1545 | |
| 1546 | MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS* |
| 1547 | Not supported. |
| 1548 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1549 | ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND* |
| 1550 | Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND| |
| 1551 | |
| 1552 | PSEUDOROOT (Hunspell) *spell-PSEUDOROOT* |
| 1553 | Use NEEDAFFIX instead. |spell-NEEDAFFIX| |
| 1554 | |
| 1555 | SUGSWITHDOTS (Hunspell) *spell-SUGSWITHDOTS* |
| 1556 | Adds dots to suggestions. Vim doesn't need this. |
| 1557 | |
| 1558 | SYLLABLENUM (Hunspell) *spell-SYLLABLENUM* |
| 1559 | Not supported. |
| 1560 | |
| 1561 | TRY (Myspell, Hunspell, others) *spell-TRY* |
| 1562 | Vim does not use the TRY item, it is ignored. For making |
Bram Moolenaar | a94bc43 | 2006-03-10 21:42:59 +0000 | [diff] [blame] | 1563 | suggestions the actual characters in the words are used, that |
| 1564 | is much more efficient. |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1565 | |
Bram Moolenaar | 4770d09 | 2006-01-12 23:22:24 +0000 | [diff] [blame] | 1566 | WORDCHARS (Hunspell) *spell-WORDCHARS* |
| 1567 | Used to recognize words. Vim doesn't need it, because there |
| 1568 | is no need to separate words before checking them (using a |
| 1569 | trie instead of a hashtable). |
| 1570 | |
Bram Moolenaar | 217ad92 | 2005-03-20 22:37:15 +0000 | [diff] [blame] | 1571 | vim:tw=78:sw=4:ts=8:ft=help:norl: |