vimtricks.wiki Concise Vim tricks, one at a time.

How do I see spelling correction suggestions for a misspelled word?

Answer

z=

Explanation

When spell checking is enabled, the z= command opens a numbered list of spelling suggestions for the misspelled word under the cursor. Select a number and press <CR> to replace the word with the correct spelling — no manual retyping required.

How it works

  • First, enable spell checking with :set spell (and optionally :set spelllang=en_us)
  • Misspelled words are highlighted (typically with a red underline)
  • Navigate to a misspelled word with ]s (next misspelled) or [s (previous misspelled)
  • Press z= to open the suggestion list
  • Type the number of the correct suggestion and press <CR> to apply the replacement
  • Press <Esc> or <CR> without a number to cancel

Example

Given the text with spell checking enabled:

The definately best approch is to refactor.

Vim underlines definately and approch. Navigate to definately and press z=:

Change "definately" to:
 1 "definitely"
 2 "definable"
 3 "defiantly"
 4 "definite"
...
Type number and <Enter> or click with mouse (empty cancels):

Type 1<CR> and the word is corrected:

The definitely best approch is to refactor.

Move to approch with ]s, press z=, select approach, and it's fixed.

Tips

  • Use 1z= to automatically accept the first suggestion without seeing the list — this is correct most of the time and saves a keystroke
  • Use ]s and [s to jump forward and backward between misspelled words without scanning visually
  • zg adds the word under the cursor to your personal spell file (marks it as "good") — use this for proper nouns, technical terms, and jargon
  • zw marks a word as misspelled ("wrong") — the opposite of zg
  • zug undoes a zg or zw addition
  • Your personal word list is stored in ~/.vim/spell/en.utf-8.add (or equivalent for your language) and persists across sessions
  • Combine spell checking with autocmd FileType to enable it only for prose: autocmd FileType markdown,text,gitcommit setlocal spell
  • Use set spellcapcheck= to disable the capital-letter-at-start-of-sentence check if it produces too many false positives in code comments

Next

How do I edit multiple lines at once using multiple cursors in Vim?