227
|
1 *spell.txt* For Vim version 7.0aa. Last change: 2005 Mar 22
|
221
|
2
|
|
3
|
|
4 VIM REFERENCE MANUAL by Bram Moolenaar
|
|
5
|
|
6
|
|
7 Spell checking *spell*
|
|
8
|
|
9 1. Quick start |spell-quickstart|
|
|
10 X. Spell file format |spell-file-format|
|
|
11
|
|
12 {Vi does not have any of these commands}
|
|
13
|
|
14 Spell checking is not available when the |+syntax| feature has been disabled
|
|
15 at compile time.
|
|
16
|
|
17 ==============================================================================
|
|
18 1. Quick start *spell-quickstart*
|
|
19
|
|
20 This command switches on spell checking: >
|
|
21
|
|
22 :setlocal spell spelllang=en_us
|
|
23
|
|
24 This switches the 'spell' option on and specifies to check for US English.
|
|
25
|
|
26 The 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
|
227
|
32 PERFORMANCE
|
|
33
|
|
34 Note that Vim does on-the-fly spellchecking. To make this work fast the
|
|
35 word list is loaded in memory. Thus this uses a lot of memory (2 Mbyte or
|
|
36 more). There might also be a noticable delay when the word list is loaded,
|
|
37 which happens when 'spelllang' is set. Each word list is only loaded once,
|
|
38 they are not deleted when 'spelllang' is made empty. When 'encoding' is set
|
|
39 the word lists are reloaded, thus you may notice a delay then too.
|
|
40
|
|
41
|
221
|
42 REGIONS
|
|
43
|
|
44 A word may be spelled differently in various regions. For example, English
|
|
45 comes in (at least) these variants:
|
|
46
|
|
47 en all regions
|
|
48 en_us US
|
|
49 en_gb Great Britain
|
|
50 en_ca Canada
|
|
51
|
|
52 Words that are not used in one region but are used in another region are
|
|
53 highlighted with SpellLocal.
|
|
54
|
|
55 Always use lowercase letters.
|
|
56
|
|
57
|
|
58 SPELL FILES
|
|
59
|
|
60 Vim searches for spell files in the "spell" subdirectory of the directories in
|
|
61 'runtimepath'. The name is: xx.yyy.spl, where:
|
|
62 xx the language name
|
|
63 yyy the value of 'encoding'
|
|
64
|
|
65 Exception: Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign
|
|
66 doesn't matter for spelling.
|
|
67
|
227
|
68 Spelling for EBCDIC is currently not supported.
|
|
69
|
221
|
70 A spell file might not be available in the current 'encoding'. You may try
|
|
71 using the "iconv" program to create one: >
|
|
72
|
|
73 iconv -f latin1 -t koi8-r de.latin1.spl >de.koi8-r.spl
|
|
74
|
|
75 However, if some characters cannot be presented in the target encoding this
|
|
76 will give wrong results.
|
|
77
|
|
78 If a spell file only uses ASCII characters the encoding can be omitted. This
|
|
79 is useful for English: "en.spl" The file with encoding is checked first, thus
|
|
80 you could have one with encoding that includes words with non-ASCII characters
|
|
81 and use the ASCII file as a fall-back.
|
|
82
|
227
|
83
|
|
84 WORDS
|
|
85
|
|
86 Vim uses a fixed method to recognize a word. This is independent of
|
|
87 'iskeyword', so that it also works in help files and for languages that
|
|
88 include characters like '-' in 'iskeyword'. The word characters do depend on
|
|
89 'encoding'.
|
|
90
|
|
91 A word that starts with a digit is always ignored.
|
|
92
|
|
93
|
|
94 SYNTAX HIGHLIGHTING
|
|
95
|
|
96 Files that use syntax highlighting can specify where spell checking should be
|
|
97 done:
|
|
98
|
|
99 everywhere default
|
|
100 in specific items use "contains=@Spell"
|
|
101 everywhere but specific items use "contains=@NoSpell"
|
|
102
|
|
103 Note that mixing @Spell and @NoSpell doesn't make sense.
|
|
104
|
221
|
105 ==============================================================================
|
|
106 X. Spell file format *spell-file-format*
|
|
107 *E751*
|
|
108
|
|
109 The spelling for a language is specified in file with a specific format.
|
|
110 The first character of a line specifies what follows in the line:
|
|
111
|
227
|
112 line meaning ~
|
|
113 -xx[-yy]... words for region xx (and region yy, etc.) follow
|
|
114 <word> normal word
|
|
115 ><word> rare word
|
|
116 +<word> optional addition after a word
|
|
117 !<word> normal word, keep upper/lower case
|
|
118 !><word> rare word, keep upper/lower case
|
|
119 !+<word> optional word addition, keep upper/lower case
|
|
120 #<anything> comment
|
221
|
121
|
|
122 Empty lines are ignored. The word continues until the end of the line. Watch
|
|
123 out for trailing white space!
|
|
124
|
227
|
125 Words that start with an upper-case letter will be required to start with an
|
|
126 upper-case letter. Otherwise, words must be in lower-case and case is
|
|
127 ignored.
|
221
|
128
|
|
129 It is possible that a word appears both with an upper-case letter and as a
|
|
130 rare word. This means that the word with an upper-case letter is OK and the
|
|
131 word without the upper-case letter is rare.
|
|
132 *E753*
|
|
133 The region is specified with "-xx". For example, in the "en.spl" file "-us"
|
|
134 starts the word for "en_us". This can be repeated for words that are used in
|
|
135 more than one region. For example "-ca-us" is used for Canadian and US
|
|
136 English words. Use "---" to go back to the words for all regions.
|
|
137
|
227
|
138 Vim supports up to eight regions. *E752*
|
221
|
139
|
|
140 It is possible to have a match that starts with a valid word. In that case
|
|
141 the match is used, because it is longer. Example:
|
|
142
|
|
143 we
|
|
144 =we're
|
|
145
|
|
146 "re" is not a word, thus "=we're" is needed to avoid it gets highlighted.
|
|
147
|
|
148 The "+" items may appear after any word. For English "'s" is used. Be
|
|
149 careful with this, it may hide mistakes.
|
|
150
|
|
151 Vim will check for duplicate words in the files used, but you will only get
|
|
152 warnings if the 'verbose' option is set to 1 or more.
|
|
153
|
|
154 Note that the "=" and "+" words will slow down the operation. Use them only
|
|
155 when really needed.
|
|
156
|
|
157
|
|
158 vim:tw=78:sw=4:ts=8:ft=help:norl:
|