Find Plugfile under rtp

This commit is contained in:
Junegunn Choi 2013-09-25 22:35:34 +09:00
parent 87901b671c
commit a663670c2b

View File

@ -93,11 +93,9 @@ function! plug#end()
set nocompatible set nocompatible
filetype off filetype off
for plug in values(g:plugs) for plug in values(g:plugs)
let dir = plug.dir let rtp = s:rtp(plug)
let rtp = dir.get(plug, 'rtp', '')
if rtp !~ '/$' | let rtp .= '/' | endif
execute "set rtp^=".rtp execute "set rtp^=".rtp
if isdirectory(dir.'after') if isdirectory(rtp.'after')
execute "set rtp+=".rtp.'after' execute "set rtp+=".rtp.'after'
endif endif
endfor endfor
@ -105,6 +103,12 @@ function! plug#end()
syntax on syntax on
endfunction 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(...) function! s:add(...)
let force = a:1 let force = a:1
let opts = { 'branch': 'master' } let opts = { 'branch': 'master' }
@ -251,8 +255,7 @@ function! s:extend(names)
try try
command! -nargs=+ Plug call s:add(0, <args>) command! -nargs=+ Plug call s:add(0, <args>)
for name in a:names for name in a:names
let spec = g:plugs[name] let plugfile = s:rtp(g:plugs[name]) . s:plug_file
let plugfile = spec.dir . '/'. s:plug_file
if filereadable(plugfile) if filereadable(plugfile)
execute "source ". plugfile execute "source ". plugfile
endif endif