aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-11-28 16:12:26 +1300
committerTom Ryder <tom@sanctum.geek.nz>2020-11-28 16:12:26 +1300
commit0d70cfc626e1b77c7e31b8cdc35f8d3edc507bab (patch)
treef14ea10d4f0cefb834da2195e67389b70024e256
parentMerge branch 'hotfix/v1.0.2' (diff)
parentBump VERSION (diff)
downloadvim-spellfile-local-0d70cfc626e1b77c7e31b8cdc35f8d3edc507bab.tar.gz
vim-spellfile-local-0d70cfc626e1b77c7e31b8cdc35f8d3edc507bab.zip
Merge branch 'release/v1.1.0'v1.1.0
* release/v1.1.0: Refactor filename escape filter for Windows
-rw-r--r--VERSION2
-rw-r--r--autoload/spellfile_local.vim13
2 files changed, 6 insertions, 9 deletions
diff --git a/VERSION b/VERSION
index 6d7de6e..9084fa2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.2
+1.1.0
diff --git a/autoload/spellfile_local.vim b/autoload/spellfile_local.vim
index 1ae937b..a7f7a7d 100644
--- a/autoload/spellfile_local.vim
+++ b/autoload/spellfile_local.vim
@@ -90,15 +90,12 @@ function! spellfile_local#() abort
endfunction
" Escape a path for use as a valid option file name; replace any characters
-" not in 'isfname' with percent symbols
+" that won't work nicely as filenames with percent signs
function! s:Filename(parts) abort
- let filename = ''
- for char in split(join(a:parts, '.'), '\zs')
- let filename .= (char !=# '_' && char !=# '/' && char =~# '^\f$')
- \ ? char
- \ : '%'
- endfor
- return filename
+ let pat = has('win32') || has('win64')
+ \ ? '\c[^[:filename:]]\|[\\/:*?"<>|]'
+ \ : '\c[^[:filename:]]\|[_/]'
+ return substitute(join(a:parts, '.'), pat, '%', 'g')
endfunction
" Join a list of strings into a comma-separated option