From d2e2635fa5020ed12d570cdb691c0375238cb9f9 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 11 Jun 2019 15:24:01 +1200 Subject: Clean up ad-hoc plugins These might end up packaged shortly. --- vim/plugin/spellfile_local.vim | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'vim/plugin/spellfile_local.vim') 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 zG 2zg - xnoremap 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 -- cgit v1.2.3