From a663670c2b4aeb069e563e31867711c140a387f8 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 25 Sep 2013 22:35:34 +0900 Subject: [PATCH] Find Plugfile under rtp --- plug.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plug.vim b/plug.vim index 82d59cb..dd3a7c5 100644 --- a/plug.vim +++ b/plug.vim @@ -93,11 +93,9 @@ function! plug#end() set nocompatible filetype off for plug in values(g:plugs) - let dir = plug.dir - let rtp = dir.get(plug, 'rtp', '') - if rtp !~ '/$' | let rtp .= '/' | endif + let rtp = s:rtp(plug) execute "set rtp^=".rtp - if isdirectory(dir.'after') + if isdirectory(rtp.'after') execute "set rtp+=".rtp.'after' endif endfor @@ -105,6 +103,12 @@ function! plug#end() syntax on endfunction +function! s:rtp(spec) + let rtp = a:spec.dir . get(a:spec, 'rtp', '') + if rtp !~ '/$' | let rtp .= '/' | endif + return rtp +endfunction + function! s:add(...) let force = a:1 let opts = { 'branch': 'master' } @@ -251,8 +255,7 @@ function! s:extend(names) try command! -nargs=+ Plug call s:add(0, ) for name in a:names - let spec = g:plugs[name] - let plugfile = spec.dir . '/'. s:plug_file + let plugfile = s:rtp(g:plugs[name]) . s:plug_file if filereadable(plugfile) execute "source ". plugfile endif