aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/spellfile_local.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/plugin/spellfile_local.vim')
-rw-r--r--vim/plugin/spellfile_local.vim18
1 files changed, 13 insertions, 5 deletions
diff --git a/vim/plugin/spellfile_local.vim b/vim/plugin/spellfile_local.vim
index f6918bfb..07307754 100644
--- a/vim/plugin/spellfile_local.vim
+++ b/vim/plugin/spellfile_local.vim
@@ -1,12 +1,20 @@
+"
+" spellfile_local.vim: Set extra 'spellfile' elements for full file paths and
+" filetype, to give the option of adding to file-specific or filetype-specific
+" spelling word lists.
+"
+" Author: Tom Ryder <tom@sanctum.geek.nz>
+" License: Same as Vim itself
+"
if exists('loaded_spellfile_local') || &compatible
finish
endif
let loaded_spellfile_local = 1
-command! -bar SetLocalSpellFiles
- \ call spellfile_local#()
-
+" For various events involving establishing or renaming a file buffer or
+" changing its filetype, rebuild the 'spellfile' definition accordingly
+"
augroup spellfile_local
- autocmd BufNew,BufRead *
- \ SetLocalSpellFiles
+ autocmd BufFilePost,BufNewFile,BufRead,EncodingChanged,FileType *
+ \ call spellfile_local#()
augroup END