aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2023-04-06 16:00:00 +1200
committerTom Ryder <tom@sanctum.geek.nz>2023-04-06 16:00:00 +1200
commit6199ee785c6fb964292ec6e82c5b8a0f79e26069 (patch)
treeacb4e2286730b3dab720467b9c1f95cc500d86fc
parentMerge branch 'hotfix/v1.1.1' (diff)
parentAdjust logic and comments for picking paths (diff)
downloadvim-spellfile-local-master.tar.gz
vim-spellfile-local-master.zip
Merge branch 'release/v2.0.0'HEADv2.0.0masterdevelop
* release/v2.0.0: Adjust logic and comments for picking paths Require Vim version 8.0, inline OptionSet If OptionSet is available, trigger on 'spelllang' Add a version guard
-rw-r--r--VERSION2
-rw-r--r--autoload/spellfile_local.vim24
-rw-r--r--doc/spellfile_local.txt2
-rw-r--r--plugin/spellfile_local.vim4
4 files changed, 17 insertions, 15 deletions
diff --git a/VERSION b/VERSION
index 524cb55..227cea2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.1
+2.0.0
diff --git a/autoload/spellfile_local.vim b/autoload/spellfile_local.vim
index 177503f..dc9d2cc 100644
--- a/autoload/spellfile_local.vim
+++ b/autoload/spellfile_local.vim
@@ -15,24 +15,24 @@ function! spellfile_local#() abort
return
endif
let lang = split(spelllangs[0], '_')[0]
- let encoding = &encoding
" Make a list of all the spellfile names for which we want to search in
- " every directory; the first is the normal lang.encoding.add, the second is
- " filename.lang.encoding.add, and the third, if there's a filetype set, is
+ " every directory; first is the normal lang.encoding.add, then if there's
+ " a path set filename.lang.encoding.add, and then if there's a filetype set,
" filetype.lang.encoding.add.
"
- let basenames = [s:Filename([lang, encoding, 'add'])]
- let path = expand('<afile>:p')
- call add(
- \ basenames,
- \ s:Filename(['path', path, lang, encoding, 'add'])
- \)
- let filetype = &filetype
- if filetype !=# ''
+ let basenames = [s:Filename([lang, &encoding, 'add'])]
+ let path = expand('%:p')
+ if path !=# ''
+ call add(
+ \ basenames,
+ \ s:Filename(['path', path, lang, &encoding, 'add'])
+ \)
+ endif
+ if &filetype !=# ''
call add(
\ basenames,
- \ s:Filename(['filetype', filetype, lang, encoding, 'add'])
+ \ s:Filename(['filetype', &filetype, lang, &encoding, 'add'])
\)
endif
diff --git a/doc/spellfile_local.txt b/doc/spellfile_local.txt
index 37dbf81..e54a73b 100644
--- a/doc/spellfile_local.txt
+++ b/doc/spellfile_local.txt
@@ -1,4 +1,4 @@
-*spellfile_local.txt* For Vim version 7.0 Last change: 2020 May 15
+*spellfile_local.txt* For Vim version 8.0 Last change: 2023 Apr 6
DESCRIPTION *spellfile_local*
diff --git a/plugin/spellfile_local.vim b/plugin/spellfile_local.vim
index 0730775..be2956c 100644
--- a/plugin/spellfile_local.vim
+++ b/plugin/spellfile_local.vim
@@ -6,7 +6,7 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('loaded_spellfile_local') || &compatible
+if exists('loaded_spellfile_local') || &compatible || v:version < 800
finish
endif
let loaded_spellfile_local = 1
@@ -17,4 +17,6 @@ let loaded_spellfile_local = 1
augroup spellfile_local
autocmd BufFilePost,BufNewFile,BufRead,EncodingChanged,FileType *
\ call spellfile_local#()
+ autocmd OptionSet spelllang
+ \ call spellfile_local#()
augroup END