vim

How to change the location of Vim `spellfile`?


Under utf-8 encoding and set spell spelllang=en_us, pressing zg when cursor is on a "wrongly spelled" word (as recognized by the spell-checker) will add the "good word" to the following file in my system: .vim/spell/en.utf-8.add.

Is there a way to change the location of this spell-file? It is a pain syncing all my "good words" across multiple machines. Ideally, re-directing such spellfile to a sub-folder in Dropbox shall solve the problem. Yet, I have not yet found documentation for this.


Solution

  • Solution for Windows machine Gvim

    The following specification works with Gvim on my Windows machine:

    set spell spelllang=en_us spell
        set spellsuggest=fast,20 "Don't show too much suggestion for spell check.
        set spellfile=c:\Users\llinfeng\Dropbox\Tool\Vim_Spell_add\en.utf-8.add
    

    It appears that the set spellfile only take on *.add file per spelllang. (To make the change of spellfile effective, simply adding an arbitrary good word (zg) shall refresh the whole thing.)

    Now, my spell file synchronizes nicely through Dropbox, across my Windows machines.

    Solution for macOS 10.12.1, for MacVIM mvim

    set spell spelllang=en_us
         set spellsuggest=fast,20 "Don't show too much suggestion for spell check.
         set spellfile=~/Dropbox/Tool/Vim_Spell_add/en.utf-8.add
    

    Solution for Linux machine, for both vim and gvim

    set spell spelllang=en_us
         set spellsuggest=fast,20 "Don't show too much suggestion for spell check.
         set spellfile=~/Dropbox/Tool/Vim_Spell_add/en.utf-8.add