mirror of
https://github.com/junegunn/vim-plug.git
synced 2026-10-07 20:44:35 +08:00
Use isdirectory() to check plugin directories (#1340)
Test vim-plug / build (vim) (push) Canceled after 0s
Test vim-plug / build (vim) (push) Canceled after 0s
finddir() and globpath() are much slower than isdirectory() for a single literal path, especially on Windows. s:reorg_rtp() runs on every lazy load and checked the after directory of all loaded plugins with globpath(). Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
This commit is contained in:
1 parent
88e3147181
commit
4da42e9a5c
1 file changed
+2
-2
@@ -550,7 +550,7 @@ function! s:reorg_rtp()
|
||||
|
||||
let s:middle = get(s:, 'middle', &rtp)
|
||||
let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])')
|
||||
let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)')
|
||||
let afters = map(filter(copy(rtps), 'isdirectory(v:val."/after")'), 's:path(v:val."/after")')
|
||||
let rtp = join(map(rtps, 'escape(v:val, ",")'), ',')
|
||||
\ . ','.s:middle.','
|
||||
\ . join(map(afters, 'escape(v:val, ",")'), ',')
|
||||
@@ -573,7 +573,7 @@ function! s:dobufread(names)
|
||||
for name in a:names
|
||||
let path = s:rtp(g:plugs[name])
|
||||
for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
|
||||
if len(finddir(dir, path))
|
||||
if isdirectory(path.'/'.dir)
|
||||
if exists('#BufRead')
|
||||
doautocmd BufRead
|
||||
endif
|
||||
|
||||
Reference in new issue
Block a user