Avoid invalid glob during tab complete

Resolves: https://github.com/tpope/vim-fugitive/issues/2050
This commit is contained in:
Tim Pope
2022-09-04 05:37:27 -04:00
parent b411b753f8
commit dd8107cabf

View File

@@ -2397,7 +2397,7 @@ function! s:GlobComplete(lead, pattern, ...) abort
if a:lead ==# '/'
return []
else
let results = glob(a:lead . a:pattern, a:0 ? a:1 : 0, 1)
let results = glob(substitute(a:lead . a:pattern, '[\{}]', '\\&', 'g'), a:0 ? a:1 : 0, 1)
endif
call map(results, 'v:val !~# "/$" && isdirectory(v:val) ? v:val."/" : v:val')
call map(results, 'v:val[ strlen(a:lead) : -1 ]')