A feature that identifies and highlights misspelled words, and lets you choose among possible correct replacements.
Inline spell-checking is available in Vim since version 7. It can be turned on with the command:
:set spell spelllang=en_us
where en_us
is the name of the dictionary to use as reference. While it is running, it will highlight words using four different colors:
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|
After moving the cursor on a misspelled word, z=
can be used to get a list of replacement candidates. If the word is highlighted as misspelled, but you still think it is correct, you can add it to the dictionary instead, using zg
.
To turn the feature off, use:
:set nospell
Full documentation: spell vimdoc