*spell.txt* For Vim version 7.0aa. Last change: 2006 Mar 01
VIM REFERENCE MANUAL by Bram Moolenaar
Spell checking *spell*
1. Quick start |spell-quickstart|
2. Remarks on spell checking |spell-remarks|
3. Generating a spell file |spell-mkspell|
4. 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 on the 'spell' option and specifies to check for US English.
The words that are not recognized are highlighted with one of these:
SpellBad word not recognized |hl-SpellBad|
SpellCap word not capitalised |hl-SpellCap|
SpellRare rare word |hl-SpellRare|
SpellLocal wrong spelling for selected region |hl-SpellLocal|
Vim only checks words for spelling, there is no grammar check.
If the 'mousemodel' option is set to "popup" and the cursor is on a badly
spelled word or it is "popup_setpos" and the mouse pointer is on a badly
spelled word, then the popup menu will contain a submenu to replace the bad
word. Note: this slows down the appearance of the popup menu.
To search for the next misspelled word:
*]s* *E756*
]s Move to next misspelled word after the cursor.
A count before the command can be used to repeat.
'wrapscan' applies.
*[s*
[s Like "]s" but search backwards, find the misspelled
word before the cursor. Doesn't recognize words
split over two lines, thus may stop at words that are
not highlighted as bad. Does not stop at word with
missing capital at the start of a line.
*]S*
]S Like "]s" but only stop at bad words, not at rare
words or words for another region.
*[S*
[S Like "]S" but search backwards.
To add words to your own word list:
*zg*
zg Add word under the cursor as a good word to the first
name in 'spellfile'. A count may precede the command
to indicate the entry in 'spellfile' to be used. A
count of two uses the second entry.
In Visual mode the selected characters are added as a
word (including white space!).
When the cursor is on text that is marked as badly
spelled then the marked text is used.
Otherwise the word under the cursor, separated by
non-word characters, is used.
If the word is explicitly marked as bad word in
another spell file the result is unpredictable.
*zG*
zG Like "zg" but add the word to the internal word list
|internal-wordlist|.
*zw*
zw Like "zg" but mark the word as a wrong (bad) word.
*zW*
zW Like "zw" but add the word to the internal word list
|internal-wordlist|.
*:spe* *:spellgood*
:[count]spe[llgood] {word}
Add {word} as a good word to 'spellfile', like with
"zg". Without count the first name is used, with a
count of two the second entry, etc.
:spe[llgood]! {word} Add {word} as a good word to the internal word list,
like with "zG".
*:spellw* *:spellwrong*
:[count]spellw[rong] {word}
Add {word} as a wrong (bad) word to 'spellfile', as
with "zw". Without count the first name is used, with
a count of two the second entry, etc.
:spellw[rong]! {word} Add {word} as a wrong (bad) word to the internal word
list.
After adding a word to 'spellfile' with the above commands its associated
".spl" file will automatically be updated and reloaded. If you change
'spellfile' manually you need to use the |:mkspell| command. This sequence of
commands mostly works well: >
:edit <file in 'spellfile'>
< (make changes to the spell file) >
:mkspell! %
More details about the 'spellfile' format below |spell-wordlist-format|.
*internal-wordlist*
The internal word list is used for all buffers where 'spell' is set. It is
not stored, it is lost when you exit Vim. It is also cleared when 'encoding'
is set.
Finding suggestions for bad words:
*z=*
z= For the word under/after the cursor suggest correctly
spelled words. This also works to find alternatives
for a word that is not highlighted as a bad word,
e.g., when the word after it is bad.
In Visual mode the highlighted text is taken as the
word to be replaced.
The results are sorted on similarity to the word being
replaced.
This may take a long time. Hit CTRL-C when you get
bored.
If the command is used without a count the
alternatives are listed and you can enter the number
of your choice or press <Enter> if you don't want to
replace. You can also use the mouse to click on your
choice (only works if the mouse can be used in Normal