mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
Avoid unnecessary runtime command (#434)
This commit is contained in:
parent
16902f9003
commit
c3d57ac6b5
17
plug.vim
17
plug.vim
@ -149,10 +149,14 @@ function! s:to_s(v)
|
|||||||
return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n"
|
return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:glob(from, pattern)
|
||||||
|
return s:lines(globpath(a:from, a:pattern))
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:source(from, ...)
|
function! s:source(from, ...)
|
||||||
let found = 0
|
let found = 0
|
||||||
for pattern in a:000
|
for pattern in a:000
|
||||||
for vim in s:lines(globpath(a:from, pattern))
|
for vim in s:glob(a:from, pattern)
|
||||||
execute 'source' s:esc(vim)
|
execute 'source' s:esc(vim)
|
||||||
let found = 1
|
let found = 1
|
||||||
endfor
|
endfor
|
||||||
@ -428,11 +432,12 @@ function! s:lod(names, types, ...)
|
|||||||
for dir in a:types
|
for dir in a:types
|
||||||
call s:source(rtp, dir.'/**/*.vim')
|
call s:source(rtp, dir.'/**/*.vim')
|
||||||
endfor
|
endfor
|
||||||
for pat in a:000
|
if a:0
|
||||||
if !s:source(rtp, pat)
|
if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
|
||||||
execute 'runtime' pat
|
execute 'runtime' a:1
|
||||||
endif
|
endif
|
||||||
endfor
|
call s:source(rtp, a:2)
|
||||||
|
endif
|
||||||
if exists('#User#'.name)
|
if exists('#User#'.name)
|
||||||
execute 'doautocmd User' name
|
execute 'doautocmd User' name
|
||||||
endif
|
endif
|
||||||
@ -1736,7 +1741,7 @@ function! s:shellesc(arg)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:glob_dir(path)
|
function! s:glob_dir(path)
|
||||||
return map(filter(s:lines(globpath(a:path, '**')), 'isdirectory(v:val)'), 's:dirpath(v:val)')
|
return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:progress_bar(line, bar, total)
|
function! s:progress_bar(line, bar, total)
|
||||||
|
Loading…
Reference in New Issue
Block a user