Am 29.06.2012 15:29, schrieb Tobias Klausmann:
> Hi!
>
> I do a fair amount of LaTeXing, across a wider selection of
> subjects. Since most of these subjects have their own jargon, I
> usually add quite a few words to my local spell files (using zg).
>
> The problem is that since there are a lot of acronyms, there is a
> good chance that the spellchecker misses a typo because it is a
> proper word/acronym in a different context/document.
>
> So ideally, I'd be able to have a spell file per directory (this
> would also make using version control easier). All this while
> still using the user-global spell file in ~/.vim.
>
> Algorithmically:
>
> - Load system-global word lists*
> - Load word lists from runtimepath*
> - if there is a possibly empty local spellfile conforming to some
> naming scheme, load it, implicitly creating the .spl file
>
> When spellchecking
> - When using zg/zw, use local-to-directory spell file, keeping
> .spl up-to-date, of course.
>
> If there is no dir-local spell file, just use the user-global
> file (usually in ~/.vim).
>
> While I'm sure I could come up with a vim script to do all of
> this, I'd very much prefer to use something already done. My vim
> script skills are waaaay rusty and why reinvent a wheel (badly at
> that). Even better would to achieve this (or some close
> approximation) using vim options.
The following is from the help:
:h 'spellfile'
string (default empty), local to buffer
Name of the word list file where words are added for the |zg|
and |zw| commands.
:h spell-load
Vim searches for spell files in the "spell" subdirectory of the
directories in 'runtimepath' ... Only the first file is loaded
... If this succeeds then additionally files with the name
LL.EEE.add.spl are loaded. All the ones that are found are
used.
LL the language name
EEE the value of 'encoding'
=> what you want should be possible.
You could add to ~/.vim/after/ftplugin/tex.vim:
let b:spellfile = expand('%:p:h'). '/myspell.latin1.add'
if filereadable(b:spellfile)
let &l:spf = b:spellfile
else
setl spf=
endif
This lets each tex file use the spell file myspell.latin1.add from its
directory. Example assumes encoding "latin1", and that setting the
option does not create the spell file yet ...
or (with b:undo_ftplugin):
let b:spellfile = expand('%:p:h'). '/myspell.latin1.add'
if filereadable(b:spellfile)
let &l:spf = b:spellfile
let b:undo_ftplugin .= '|setl spf<'
endif
let b:undo_ftplugin .= '|unlet! b:spellfile'
(warning: almost untested)
Vim automatically creates the .spl files.
--
Andy
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment