Now that I have started writing more blog posts, I have been thinking more about spell checking. :)
Vim
has a cool feature for spell checking. This can be done easily by
spell_check
plugin, but vim has its
own spell
option which
works much better and has native vim
support.
NOTE: Spell doesn’t work as expected when syntax
is disabled
To enable spell check, call :set spell spelllang=en_us
. This will mark all
the words that are misspelled. In order to navigate to the misspelled word
hit ]s
(for next misspelled word) or [s
(for previous misspelled word).
Once on a misspelled word, you can either use zg
to add the word to the list
of “good” words, or use z=
to get correction suggestions from vim (This also
works for a word which isn’t highlighted as a “bad” word).
You can also use zw
to remove current word from the spell file (list of
good words).
Another way of fixing the error is to use <C-x>s
from the insert mode which
triggers an autocompletion form.
To turn spell
mode off, call :set nospell
.
See :h spell
and :h compl-spelling
for more details.