26

I'm using gvim:

$ gvim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 16 2017 06:36:51)
MacOS X (unix) version
Included patches: 1-329
Compiled by Homebrew

I was editing the following line of text:

enable mouse scrolling, pane selection, pan reiszing and so on.

I noticed "reiszing" was misspelled so I used the following command to turn on spellcheck:

setlocal spell spelllang=en_us

"reiszing" was highlighted as expected but then I accidently used the zg command which added the word to my dictionary. I grepped through /usr/share/dict/words but didn't find "reiszing".

  • How do I remove this word from my dictionary?
  • If the word isn't stored in /usr/share/dict/words, then where is it?

I read in another answer that the command

set runtimepath?

Can be used to find the paths that vim uses:

~/.vim
/usr/local/Cellar/macvim/8.0-127/MacVim.app/Contents/Resources/vim/vimfiles
/usr/local/Cellar/macvim/8.0-127/MacVim.app/Contents/Resources/vim/runtime
/usr/local/Cellar/macvim/8.0-127
/MacVim.app/Contents/Resources/vim/vimfiles/after
~/.vim/after

I was able to fix my problem by blowing away the files:

$ rm /usr/local/Cellar/macvim/8.0-127/MacVim.app/Contents/Resources/vim/runtime/spell/en.utf-8.add
$ rm /usr/local/Cellar/macvim/8.0-127/MacVim.app/Contents/Resources/vim/runtime/spell/en.utf-8.add.spl

This worked fine for me now becuase it was the first time this happened but I'm curious if there is a simpler and less destructive way to remove a word from the dictionary after adding it with the zg command.

I've tried cmd + fing the spell man page for "remove word" but found nothing.

2
  • sorry for the typo! please see edit
    – mbigras
    Commented Mar 17, 2017 at 17:25
  • 1
    Do you mean zg (instead of ng) ? :-) Commented Mar 17, 2017 at 17:25

1 Answer 1

35

To remove a word, try zuw and/or zug

I've tried cmd + fing the spell man page for "remove word" but found nothing.

For a cmd+f search, I have had more success searching only on "remove" :-)

If you turn on spelling with setlocal spell spelllang=en_us then your long term dictionary is in your home directory. Mine is at:

 ~/.vim/spell/en.utf-8.add 

This is where zg adds words.

While you can edit ~/.vim/spell/en.utf-8.add in vim under a different tab to remove erroneous entries, the zug command is probably easier. :-)

The zG command adds to a temporary file, under /tmp

help spellfile (help spf) can provide more details about the file's location and format.

1
  • thank you for the response StandardEyre, I updated my question, the file you mentioned doesn't exist
    – mbigras
    Commented Mar 17, 2017 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.