blob: 91dba4dcaaa7b4ae96a5376894e0d8533c7be053 [file] [log] [blame]
Bram Moolenaar217ad922005-03-20 22:37:15 +00001*spell.txt* For Vim version 7.0aa. Last change: 2005 Mar 20
2
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
7Spell checking *spell*
8
91. Quick start |spell-quickstart|
10X. Spell file format |spell-file-format|
11
12{Vi does not have any of these commands}
13
14Spell checking is not available when the |+syntax| feature has been disabled
15at compile time.
16
17==============================================================================
181. Quick start *spell-quickstart*
19
20This command switches on spell checking: >
21
22 :setlocal spell spelllang=en_us
23
24This switches the 'spell' option on and specifies to check for US English.
25
26The words that are not recognized are highlighted with one of these:
27 SpellBad word not recognized
28 SpellRare rare word
29 SpellLocal wrong spelling for selected region
30
31
32REGIONS
33
34A word may be spelled differently in various regions. For example, English
35comes in (at least) these variants:
36
37 en all regions
38 en_us US
39 en_gb Great Britain
40 en_ca Canada
41
42Words that are not used in one region but are used in another region are
43highlighted with SpellLocal.
44
45Always use lowercase letters.
46
47
48SPELL FILES
49
50Vim searches for spell files in the "spell" subdirectory of the directories in
51'runtimepath'. The name is: xx.yyy.spl, where:
52 xx the language name
53 yyy the value of 'encoding'
54
55Exception: Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign
56doesn't matter for spelling.
57
58A spell file might not be available in the current 'encoding'. You may try
59using the "iconv" program to create one: >
60
61 iconv -f latin1 -t koi8-r de.latin1.spl >de.koi8-r.spl
62
63However, if some characters cannot be presented in the target encoding this
64will give wrong results.
65
66If a spell file only uses ASCII characters the encoding can be omitted. This
67is useful for English: "en.spl" The file with encoding is checked first, thus
68you could have one with encoding that includes words with non-ASCII characters
69and use the ASCII file as a fall-back.
70
71==============================================================================
72X. Spell file format *spell-file-format*
73 *E751*
74
75The spelling for a language is specified in file with a specific format.
76The first character of a line specifies what follows in the line:
77
78 char argument meaning ~
79 - xx words for xx region follow (repeats)
80 <space> <word> normal word
81 > <word> rare word
82 = <word> word with non-keyword characters
83 + <word> optional word addition
84 # <anything> comment
85
86Empty lines are ignored. The word continues until the end of the line. Watch
87out for trailing white space!
88
89Words that start with an upper-case letter will be required to be written that
90way. Otherwise, words must be in lower-case.
91
92It is possible that a word appears both with an upper-case letter and as a
93rare word. This means that the word with an upper-case letter is OK and the
94word without the upper-case letter is rare.
95 *E753*
96The region is specified with "-xx". For example, in the "en.spl" file "-us"
97starts the word for "en_us". This can be repeated for words that are used in
98more than one region. For example "-ca-us" is used for Canadian and US
99English words. Use "---" to go back to the words for all regions.
100
101Vim supports up to six regions. *E752*
102
103It is possible to have a match that starts with a valid word. In that case
104the match is used, because it is longer. Example:
105
106 we
107 =we're
108
109"re" is not a word, thus "=we're" is needed to avoid it gets highlighted.
110
111The "+" items may appear after any word. For English "'s" is used. Be
112careful with this, it may hide mistakes.
113
114Vim will check for duplicate words in the files used, but you will only get
115warnings if the 'verbose' option is set to 1 or more.
116
117Note that the "=" and "+" words will slow down the operation. Use them only
118when really needed.
119
120
121 vim:tw=78:sw=4:ts=8:ft=help:norl: