Speed up globbing
Globbing with {} is really, really, slow, apparently.
This commit is contained in:
parent
fc28861b51
commit
a32cdaea9d
|
@ -113,10 +113,9 @@ function! s:detect() abort
|
||||||
endif
|
endif
|
||||||
let patterns = s:patterns_for(&filetype)
|
let patterns = s:patterns_for(&filetype)
|
||||||
call filter(patterns, 'v:val !~# "/"')
|
call filter(patterns, 'v:val !~# "/"')
|
||||||
if !empty(patterns)
|
let dir = expand('%:p:h')
|
||||||
let pattern = len(patterns) == 1 ? patterns[0] : '{'.join(patterns, ',').'}'
|
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h')
|
||||||
let dir = expand('%:p:h')
|
for pattern in patterns
|
||||||
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h')
|
|
||||||
for neighbor in split(glob(dir.'/'.pattern), "\n")
|
for neighbor in split(glob(dir.'/'.pattern), "\n")
|
||||||
if neighbor !=# expand('%:p')
|
if neighbor !=# expand('%:p')
|
||||||
call extend(options, s:guess(readfile(neighbor, '', 1024)), 'keep')
|
call extend(options, s:guess(readfile(neighbor, '', 1024)), 'keep')
|
||||||
|
@ -125,9 +124,9 @@ function! s:detect() abort
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
let dir = fnamemodify(dir, ':h')
|
endfor
|
||||||
endwhile
|
let dir = fnamemodify(dir, ':h')
|
||||||
endif
|
endwhile
|
||||||
if has_key(options, 'shiftwidth')
|
if has_key(options, 'shiftwidth')
|
||||||
return s:apply_if_ready(extend({'expandtab': 1}, options))
|
return s:apply_if_ready(extend({'expandtab': 1}, options))
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue