Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

escape glob characters #539

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion autoload/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,18 @@ function! s:filter_oldfiles_unsafe(path_prefix, path_format, use_env) abort
" https://github.com/mhinz/vim-startify/issues/353
continue
endif

let fname = fnamemodify(fname, ":p")
if exists('+shellslash') && !&shellslash
" 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, '[[\]*?\\]', '\\\0', 'g')
endif
let absolute_path = glob(fname)

let absolute_path = glob(fnamemodify(fname, ":p"))
if empty(absolute_path)
\ || has_key(entries, absolute_path)
\ || (absolute_path =~ is_dir)
Expand Down