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

How do I remove a word I accidentally added to my Vim spell dictionary?

Answer

zug

Explanation

When spell checking is active, pressing zg over a word adds it to your personal word list so Vim stops flagging it. If you accidentally add a misspelled word this way, zug immediately undoes the addition — the word is removed from the dictionary file and Vim resumes highlighting it as incorrect. The companion command zuw undoes a zw (mark-as-wrong) addition.

How it works

  • zg — mark the word under the cursor as good (add to personal dictionary)
  • zugundo the last zg (remove that word from the dictionary)
  • zw — mark the word under the cursor as wrong (add to bad-words list)
  • zuw — undo the last zw (remove from bad-words list)

Your personal dictionary is a plain-text file. Vim updates it in real time, so zug takes effect immediately without reloading.

Example

" Cursor is on the typo "recieve"
zg   " Oops! "recieve" is now in your dictionary — no longer flagged

zug  " Undo: "recieve" is removed; Vim highlights it as misspelled again

Tips

  • Your personal spellfile is usually ~/.vim/spell/en.utf-8.add — check with :set spellfile?
  • To remove an arbitrary word (not the last added), open and edit the spellfile directly: :e ~/.vim/spell/en.utf-8.add
  • When multiple spellfiles are loaded (:set spellfile=file1,file2), use 1zg / 2zg to target a specific file; 1zug / 2zug undo that specific file's last entry
  • The spell commands zg, zug, zw, and zuw only work when :set spell is active

Next

How do I display the current filename in the terminal window title bar while editing in Vim?