How do I add or remove words from Vim's spell check dictionary?
Answer
zg and zw
Explanation
When Vim's spell checker marks a word as incorrect but it is intentionally spelled that way (a name, abbreviation, or domain-specific term), you can permanently add it to your personal dictionary with zg. To mark a word as wrong and add it to your bad-words list, use zw. Both commands update your spellfile on disk so the change persists across sessions.
How it works
zg— mark the word under the cursor as good (adds it to~/.vim/spell/<lang>.utf-8.add)zw— mark the word under the cursor as wrong (adds it to thespellfileas a bad word)zug— undozg(remove from good-words list)zuw— undozw(remove from bad-words list)- The
spellfilepath is controlled by:set spellfile; you can version-control it per project
Example
Vim flags: "Kubernetes" as a misspelling
Cursor on "Kubernetes" → press zg
→ Added to spell dictionary
→ Word is no longer highlighted as an error
Press zug to undo if you change your mind
Tips
- Run
:set spell spelllang=en_usfirst to enable spell checking - Use
]s/[sto jump to the next/previous misspelling, thenzgto accept it zGandzWdo the same aszg/zwbut save to an internal word list for the current Vim session only (not written to disk)- Share your
.addspell file across machines via dotfiles to keep your custom vocabulary in sync