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)zug— undo the lastzg(remove that word from the dictionary)zw— mark the word under the cursor as wrong (add to bad-words list)zuw— undo the lastzw(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), use1zg/2zgto target a specific file;1zug/2zugundo that specific file's last entry - The spell commands
zg,zug,zw, andzuwonly work when:set spellis active