Is there any way to tell vim to update spell files for all languages listed in 'spelllang'
to pick up wordlist changes from outside of vim?
I've started checking a wordlist file into git since I'm tired of adding the same words on multiple computers. I don't want to add the spell file to the git repo since merges would be ugly every time, but whenever I open vim, any recent updates are ignored until I do something from inside vim that rebuilds the spell file, such as zg
to add a word to the dictionary.
I've solved this by adding the *.spl to the .gitignore file and then in the vimrc (which is also synced with GIT, add:
for d in glob('~/.vim/spell/*.add', 1, 1)
if filereadable(d) && (!filereadable(d . '.spl') || getftime(d) > getftime(d . '.spl'))
exec 'mkspell! ' . fnameescape(d)
endif
endfor
source: https://vi.stackexchange.com/questions/5050/how-to-share-vim-spellchecking-additions-between-multiple-machines
This will cause vim to rebuild the .spl file each time the .add file has been updated when vim is started.
I've created a Vim plugin for this. It finds the path to the spell folders automatically and then calls mkspell
on any word lists it finds at startup to regenerate the spell files. It also creates .gitignore
and .gitattributes
files in the spell directories to exclude binary spell files and to use Git's union merge driver to avoid conflicts when merging spell files from two different machines. Thanks to Sato Katsura for the mkspell
example.
https://github.com/micarmst/vim-spellsync
If you only have a single spell file, just put this in your .vimrc
:
exec 'silent mkspell! ' . &spellfile . '.spl'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With