aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/spellfile_local.vim2
-rw-r--r--plugin/spellfile_local.vim4
2 files changed, 5 insertions, 1 deletions
diff --git a/autoload/spellfile_local.vim b/autoload/spellfile_local.vim
index 177503f..7573c45 100644
--- a/autoload/spellfile_local.vim
+++ b/autoload/spellfile_local.vim
@@ -23,7 +23,7 @@ function! spellfile_local#() abort
" filetype.lang.encoding.add.
"
let basenames = [s:Filename([lang, encoding, 'add'])]
- let path = expand('<afile>:p')
+ let path = expand('%:p')
call add(
\ basenames,
\ s:Filename(['path', path, lang, encoding, 'add'])
diff --git a/plugin/spellfile_local.vim b/plugin/spellfile_local.vim
index 623b148..5e348c0 100644
--- a/plugin/spellfile_local.vim
+++ b/plugin/spellfile_local.vim
@@ -17,4 +17,8 @@ let loaded_spellfile_local = 1
augroup spellfile_local
autocmd BufFilePost,BufNewFile,BufRead,EncodingChanged,FileType *
\ call spellfile_local#()
+ if has('##OptionSet')
+ autocmd OptionSet spelllang
+ \ call spellfile_local#()
+ endif
augroup END