Use isdirectory() to check plugin directories (#1340)
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:
mattn authored and GitHub committed 2026-10-05 09:47:24 +09:00
1 parent 88e3147181
commit 4da42e9a5c
1 file changed
+2 -2
+2 -2
View File
@@ -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