Gerald Lai wrote:
Since 'spellfile' cannot be set from a modeline for security reasons,
you can try placing something like this in your vimrc:

autocmd BufWinEnter *
  \ if expand("%:t") == "myfile1.txt"     |
  \   set spellfile=myspell1.latin1.add   |
  \ elseif expand("%:t") == "myfile2.txt" |
  \   set spellfile=myspell2.utf-8.add    |
  \ else                                  |
  \   set spellfile=                      |
  \ endif                                 |


Ah, this is actually a bit too heavyweight, as it would mean keeping a rather complicated switching block in my .vimrc, that includes the full path of every LaTeX file for which I have a dictionary. Regardless, your suggestion reminded me that I can set a per directory .vimrc, so I just placed one in my project directory and I seem to be set. This isn't quite as nice as my original proposal because it means it only works if I start vim from within that directory.

Somehow I don't see how this is any less of a security risk than allowing what I proposed.

Reply via email to