12

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

11

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.

  • Also, you can add the :set spell in ~/.vimrc file, so that it will be effective for all the file. – SHW May 9 '11 at 15:04
  • quick little tutorial link is dead at the time of writing. – KutalmisB May 17 '18 at 14:14
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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.