aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/spellfile_local.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-11 15:24:01 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-11 15:24:01 +1200
commitd2e2635fa5020ed12d570cdb691c0375238cb9f9 (patch)
tree8355c379bace019995e4b0d79ea06f9cb651cef7 /vim/plugin/spellfile_local.vim
parentMerge branch 'release/v5.40.0' into develop (diff)
downloaddotfiles-d2e2635fa5020ed12d570cdb691c0375238cb9f9.tar.gz
dotfiles-d2e2635fa5020ed12d570cdb691c0375238cb9f9.zip
Clean up ad-hoc plugins
These might end up packaged shortly.
Diffstat (limited to 'vim/plugin/spellfile_local.vim')
-rw-r--r--vim/plugin/spellfile_local.vim25
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