diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-11-28 16:12:26 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-11-28 16:12:26 +1300 |
commit | 0d70cfc626e1b77c7e31b8cdc35f8d3edc507bab (patch) | |
tree | f14ea10d4f0cefb834da2195e67389b70024e256 | |
parent | Merge branch 'hotfix/v1.0.2' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-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-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/spellfile_local.vim | 13 |
2 files changed, 6 insertions, 9 deletions
@@ -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 |