Vim’s spell check is surprisingly powerful, and most users only scratch the surface by just enabling it.

Let’s get this going. First, you need to tell Vim you want spell checking. Add this to your ~/.vimrc:

set spell

When you open a file, you’ll immediately see squiggly underlines. Red for misspelled, green for a word Vim thinks is a proper noun (and thus might be misspelled in a different context), and yellow for a word that’s correctly spelled but doesn’t fit the language’s grammar rules (like "their" vs. "there" in English).

Now, how do you actually use this? The magic is in navigating and fixing.

To move to the next misspelled word, type ]s. To go to the previous one, type [s. This is your primary way to jump around.

Once you’re on a misspelled word, you have options:

  • z=: This is your best friend. It brings up a list of suggested corrections for the current word. Navigate the list with j/k or Ctrl+n/Ctrl+p and press Enter to apply the chosen correction.
  • zg: If Vim thinks a word is misspelled but you know it’s correct (like a technical term or a name), zg will add it to your personal spell file for the current language. This is how you "teach" Vim.
  • zw: This marks the current word as a spelling error. Useful if Vim is incorrectly flagging a correctly spelled word.
  • zu: This undoes the last spell correction action (zg, zw, or a z= correction).

Vim’s spell checker is language-aware. You can set the spell language like this:

set spelllang=en_us,es

This tells Vim to check against both American English and Spanish dictionaries. If a word is valid in either language, it won’t be flagged. Vim prioritizes the first language in the list.

The spell files themselves are just text files. You can find them in /usr/share/vim/vimXX/spell/ (where XX is your Vim version). Your personal additions (zg) go into a file named ~/.vim/spell/en.utf-8.add (or whatever language you’ve set).

Let’s see it in action. Imagine you have a file with this content:

This is a tset of the spell checker.
It should hlep us find mistaks.

Open this file in Vim.

  1. Type ]s. The cursor jumps to tset.
  2. Type z=. Vim will show a popup menu:
    tset
    test
    tset
    
    test is the first suggestion. Press Enter. The word changes to test.
  3. Type ]s again. The cursor jumps to hlep.
  4. Type z=. You’ll see suggestions like help. Press Enter. The word changes to help.
  5. Type ]s. The cursor jumps to mistaks.
  6. Type z=. Suggestions include mistakes. Press Enter. The word changes to mistakes.
  7. Type ]s again. The cursor should move to the end of the file or wrap around, indicating no more errors.

You can also check the spell file for a specific language without enabling it globally. For example, to check a file only for Spanish:

:setlocal spell spelllang=es

This is useful for mixed-language documents or when you’re working on a file that’s primarily in one language but contains foreign words.

Most people don’t realize that Vim’s spell checker has a concept of "compound" words. In languages like German, you can have very long words formed by combining shorter ones (e.g., Rindfleischetikettierungsüberwachungsaufgabenübertragungsgesetz). Vim can intelligently check these compound words by breaking them down into their constituent parts, even if the full word isn’t in its dictionary. This is enabled by default when a language is loaded.

If you find yourself constantly adding the same technical terms or proper nouns, consider creating a custom spell file. You can create ~/.vim/spell/myproject.utf-8.add and then in your ~/.vimrc, you can add it to the spell list:

set spell spelllang=en_us,myproject

This makes your project-specific terms available globally within Vim.

The next thing you’ll want to figure out is how to integrate Vim’s spell checking with your version control system, especially for commit messages.

Want structured learning?

Take the full Vim course →