Turn spelling on/off

Turn on spelling in vim with: set spell. Turn it off with: set nospell

American English was the default language when I switched spelling on. You can change languages with: set spell spelllang=en_gb (British English).

To turn on spelling for files with certain extensions (LaTeX .tex files): autocmd BufNewFile,BufRead *.tex set spell spelllang=en_gb.

Sometimes you might want to turn spelling on for a single buffer (e.g. when modifying a README file). Use setlocal spell to achieve this.

Word Completion

When programming, I make heavy use of CTRL-P (see https://github.com/kien/ctrlp.vim) in insert-mode to auto-complete words, you can do the same with spelling with: set complete+=kspell Use CTRL-N or CTRL-P in insert-mode for word-completion with set complete+=kspell to add dictionary scanning:

Vim spelling autocomplete screenshot


To add a word to your personal dictionary, navigate to the word you want to add and type: zg (undo with zug).

To do the opposite and mark a word as incorrect, navigate to the word and type: zw (undo with zuw).

You can find your changes in the spell directory:

Vim dictionary contents

To see a list of suggested spelling corrections, navigate to the word you want help with and type: z=:

Vim dictionary screen

Jump to bad words

To jump between misspelled words, type: ]s and [s.

For more help: :help spell.