From 16902f90034053243e3fda3c59f1d86ca7fdc4a5 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 3 Mar 2016 10:53:34 +0900 Subject: [PATCH] Use runtime only when the file is not found in the plugin directory (#434) There can be multiple files that matches the pattern (e.g. syntax/foo.vim) in &runtimepath. --- plug.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index db778d9..4e36815 100644 --- a/plug.vim +++ b/plug.vim @@ -150,11 +150,14 @@ function! s:to_s(v) endfunction function! s:source(from, ...) + let found = 0 for pattern in a:000 for vim in s:lines(globpath(a:from, pattern)) execute 'source' s:esc(vim) + let found = 1 endfor endfor + return found endfunction function! s:assoc(dict, key, val) @@ -426,7 +429,9 @@ function! s:lod(names, types, ...) call s:source(rtp, dir.'/**/*.vim') endfor for pat in a:000 - execute 'runtime' pat + if !s:source(rtp, pat) + execute 'runtime' pat + endif endfor if exists('#User#'.name) execute 'doautocmd User' name