14

Is there a way to spell check a file using vim?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Justin Ethier
  • 16,686
  • 9
  • 43
  • 55

2 Answers2

13

If you have a spell checker installed on your system, vim will usually find it. If not you will need to install ispell, aspell, hunspell or a similar system as well as support files for the language you want to check.

:set spell

Here is an answer on StackOverflow with keybindings and also a quick little tutorial for usage.

Caleb
  • 69,278
  • 18
  • 196
  • 226
7

If you want to toggle spellcheck on and off, you can add something like the following to your .vimrc:

map <F4> :setlocal spell spelllang=en_gb<CR>
map <F5> :set nospell<CR>