Skip to content

Commit c177fa3

Browse files
committed
Get directory listing with globpath
Fix dirvish for auto-mounted paths where mount root does not glob.
1 parent a197607 commit c177fa3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

autoload/dirvish.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ function! s:parent_dir(dir) abort
4242
endfunction
4343

4444
if v:version > 703
45-
function! s:globlist(pat) abort
46-
return glob(a:pat, !s:suf(), 1)
45+
function! s:globlist(dir_esc, pat) abort
46+
return globpath(a:dir_esc, a:pat, !s:suf(), 1)
4747
endfunction
4848
else "Vim 7.3 glob() cannot handle filenames containing newlines.
49-
function! s:globlist(pat) abort
50-
return split(glob(a:pat, !s:suf()), "\n")
49+
function! s:globlist(dir_esc, pat) abort
50+
return split(globpath(a:dir_esc, a:pat, !s:suf()), "\n")
5151
endfunction
5252
endif
5353

5454
function! s:list_dir(dir) abort
55-
" Escape for glob().
56-
let dir_esc = escape(substitute(a:dir,'\[','[[]','g'),'{}')
57-
let paths = s:globlist(dir_esc.'*')
55+
" Escape comma for globpath().
56+
let dir_esc = escape(a:dir, ',')
57+
let paths = s:globlist(dir_esc, '*')
5858
"Append dot-prefixed files. glob() cannot do both in 1 pass.
59-
let paths = paths + s:globlist(dir_esc.'.[^.]*')
59+
let paths = paths + s:globlist(dir_esc, '.[^.]*')
6060

6161
if get(g:, 'dirvish_relative_paths', 0)
6262
\ && a:dir != s:parent_dir(getcwd()) "avoid blank CWD

0 commit comments

Comments
 (0)