Skip to content

Commit

Permalink
update win32 glob escape regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Konfekt committed Oct 12, 2022
1 parent 8e7fe4a commit b696d18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autoload/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,12 @@ function! s:filter_oldfiles_unsafe(path_prefix, path_format, use_env) abort

let fname = fnamemodify(fname, ":p")
if exists('+shellslash') && !&shellslash
" win32
let fname = substitute(fname, '\([[\]*?]\)', '\\[\1]', 'g')
" win32 paths can't contain '*' and '?'
" though DOS device paths can contain '?', they need not be escaped
" see https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats
let fname = substitute(fname, '\[', '\[[]', 'g')
else
let fname = substitute(fname, '\([[\]*?\\]\)', '\\\1', 'g')
let fname = substitute(fname, '[[\]*?\\]', '\\\0', 'g')
endif
let absolute_path = glob(fname)

Expand Down

0 comments on commit b696d18

Please sign in to comment.