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