Spell Check in Vim

Avoid spelling mistakes when editing prose in Markdown files and Git commit messages.


In ~/.vimrc:

" Disable spelling by default, enable per-filetype
autocmd BufRead setlocal nospell

In ~/.vim/ftplugin/{gitcommit,markdown}.vim:

setlocal complete+=kspell
setlocal spell

See highlighted misspellings

When I edit a Markdown file or Git commit with git commit -v, Vim will highlight misspelled words. Move to the next misspelled word with ]s or move backwards with [s:

Add words to the dictionary

When the cursor is over a misspelled word, type zg ("good word") to add the word to the spell file. By default, the spell file is located at ~/.vim/spell/en.utf-8.add.

Word suggestions

When the cursor is over a misspelled word, get suggestions for the word with z=:

Tab completion

The words in the spell file will show up in tab completion: