diff options
Diffstat (limited to 'vim/plugin/spellfile_local.vim')
-rw-r--r-- | vim/plugin/spellfile_local.vim | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/vim/plugin/spellfile_local.vim b/vim/plugin/spellfile_local.vim index bb6421f2..b04b7573 100644 --- a/vim/plugin/spellfile_local.vim +++ b/vim/plugin/spellfile_local.vim @@ -3,32 +3,17 @@ if exists('loaded_spellfile_local') endif let loaded_spellfile_local = 1 -Establish $MYVIM/cache/spell - -let spellfile = join([ +let s:spellfile = join([ \ substitute(v:lang, '_.*', '', ''), \ &encoding \ ], '.') . '.add' -execute 'set spellfile=$MYVIM/cache/spell/'.spellfile - -Establish $MYVIM/cache/spell/local - -function! AddLocalSpellFile() abort - let spellfile = join([ - \ substitute(expand('%:p'), '[^0-9A-Za-z_.-]', '%', 'g'), - \ substitute(v:lang, '_.*', '', ''), - \ &encoding - \ ], '.') . '.add' - setlocal spellfile< - execute 'setlocal spellfile+=$MYVIM/cache/spell/local/'.spellfile - nnoremap <buffer> zG 2zg - xnoremap <buffer> zG 2zg -endfunction +Establish $MYVIM/cache/spell +execute 'set spellfile=$MYVIM/cache/spell/'.s:spellfile command! AddLocalSpellFile - \ call AddLocalSpellFile() + \ call spellfile_local#() augroup spellfile_local - autocmd BufRead * + autocmd BufNew,BufRead * \ AddLocalSpellFile augroup END |