Is there a way to tell Vim not to highlight a word once? For example, in “the password is abc123”, I don’t want to add abc123 to the wordlist, but still wouldn’t like the big red rectangle around it.
Clarification: I’m looking for a command that makes the spell checker ignore the current word (or last misspelling).
When your cursor is positioned on a word that is highlighted as misspelled you can add it to your wordlist by pressing
zg. Vim allows you to load more than one wordlist at a time, which makes it possible to have (for example) a global wordlist, and a project specific wordlist.By default, when you run
zgit will add the current word to the first spellfile it finds in your runtime path for the current encoding. In my case, that turns out to be~/.vim/spell/en.utf-8.addwhen I’m working with UTF-8 encoding. Try running the following commands:That will set you up so that
zg(or1zg) adds the current word to your default spellfile. But running2zgwould add the current word to a file calledoneoff.utf-8.add, in the same directory as the file that you are working on. If the file doesn’t exist, Vim will try to create it for you.When you open the file again in the future, you will have to run the same two commands to make Vim check the
oneoff.utf-8.addspellfile. Unfortunately, Vim does not allow you to set the spellfile option in a modeline, so if you want to run these commands automatically when the file opens, you would have to find some other way. This question includes a few ideas on how you might proceed.