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

How do I automatically apply the first spelling suggestion without opening the full suggestion list?

Answer

1z=

Explanation

The z= command opens an interactive numbered menu of spelling corrections for the word under the cursor, requiring you to type a number and press Enter. When you are confident that the first suggestion is the right fix — which is usually the case for common misspellings — prepending the count 1 selects and applies it immediately with no menu prompt.

How it works

  • z= with no count: opens a numbered menu of suggestions, waits for your choice
  • 1z=: silently applies suggestion number 1 (the highest-confidence correction) without displaying any menu
  • 2z=, 3z=: apply the 2nd or 3rd suggestion directly, useful when you already know which suggestion you want
  • The count corresponds to the ranking position Vim would show in the z= list
  • Requires spell checking to be active (:set spell or :set spelllang=en)

Example

With :set spell enabled and the cursor on the misspelled word teh:

This is teh test.

Pressing 1z= immediately replaces teh with the:

This is the test.

No popup, no confirmation — the fix is applied in one keystroke.

Tips

  • Combine with ]s to jump to the next misspelling: ]s1z= corrects in two keystrokes
  • Map <leader>s to ]s1z= for a fast spell-correct shortcut across a document
  • If the first suggestion is wrong, fall back to z= to see the full menu

Next

How do I combine two recorded macros into one without re-recording them from scratch?