0

I have two spelling addition files:

  • ~/.vim/spell/en.utf-8.add
  • ~/.vim/bundle/work/spell/en.utf-8.add

~/.vim/bundle/work is in my 'runtimepath'.

I can run this script to build .spl files for both .add files:

mkspell! ~/.vim/spell/en.utf-8.add
mkspell! ~/.vim/bundle/work/spell/en.utf-8.add

Without modifying 'spellfile', vim loads both en.utf-8.add.spl and detects words from both files.

Is there a command I can use to build the .spl files for all detected .add files (without having to list them all)?

3
  • 1
    I've posted an answer, but I'm curious about the workflow that requires this. If this is something that you are needing to do regularly it might be an XY problem. Mar 11 at 22:24
  • I use zg to add a word. It goes into the first .add. But sometimes I meant for it to go into the second. (I could set both as 'spellfile' and use 2zg, but still need a solution for when I accidentally use zg.) When I edit the .add files, vim doesn't recognize my changes because they need to be recompiled. Possibly I could move words between files (zw2zg?), but compiling seems much more straightforward. Sometimes, my vim config doesn't have the work bundle, so I wanted a single consistent command that ensures my spell files are compiled (which comes up very infrequently).
    – idbrii
    Mar 12 at 20:04
  • I keep my dotfiles (including the en.utf-8.add files but not including the spl files) in git to synchronize my config across several computers. I suspect my problem is that when I pull changes to a .add file, vim doesn't notice because it only autocompiles based on zg/zw/etc commands. So I could use this command after I pull new changes.
    – idbrii
    Mar 12 at 20:07
2

This should do it:

for d in globpath(&runtimepath, "spell/*.add", 0, 1)
    execute "mkspell! " . fnameescape(d)
endfor

This finds all spell/*.add files in your &runtimepath and executes :mkspell! on them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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