Spell checkers are really a good thing, and something almost all modern word processors have. But, when you work on a text editor, like emacs, gedit or vim, what can you do?

Today I will cover how to install spell checker functionality to vim, which is the text editor I use the most, actually almost exclusively.

First thing you need is to install the dictionary, I will install the English one for vim.

sudo pacman -S vim-spell-en

You can do it the same for your distribution using your package manager, the above command is to install it on Arch Linux.

— Alternate method —

You can also, make vim to download the dictionary for you directly from Internet.

  • First set the language

    :set spelllang=es

  • Then turn on spell checker

    :set spell

Vim, will as you to create a directory where to store downloaded dictionaries, and then, will use curl to download the needed dictionary.

You will see something like this:

vim-spell

Once installed it is really easy to use it. Just right your text document as you usually do, and then turn the spell checker on as we see before.

:set spell

If you want to turn it off

:set nospell

Once on, it will check for miss spelled words, and highlight it, then you have to use the next commands to see suggestions, and accept them, or add new words to the dictionary.

These are the commands:

  • ]s Will jump to the next wrong word
  • [s Will jump to the previous wrong word
  • z= Will show you the suggested words
  • zg Will add a highlighted word to the dictionary
  • zw Will add a bad word, mistakenly not included as miss spelled word, to the bad words dictionary

When you are watching to the suggested words, you can write the number of it, and hit Enter, to change the bad spelled word for the suggested one, or just hit enter to do nothing.