Require installed script

- so it's ready to use right after installation
This commit is contained in:
gmarik 2010-12-08 22:55:16 -06:00
parent 04ac11f435
commit e1b4ef5f09
2 changed files with 11 additions and 10 deletions

View File

@ -3,7 +3,7 @@ func! vundle#config#bundle(arg, ...)
call extend(bundle, copy(s:bundle)) call extend(bundle, copy(s:bundle))
call add(g:bundles, bundle) call add(g:bundles, bundle)
call s:rtp_add(bundle.rtpath()) call s:rtp_add(bundle.rtpath())
call s:require(bundle) call vundle#config#require(bundle)
endf endf
func! vundle#config#init() func! vundle#config#init()
@ -11,6 +11,14 @@ func! vundle#config#init()
let g:bundles = [] let g:bundles = []
endf endf
func! vundle#config#require(bundle)
call s:rtp_add(g:bundle_dir)
" TODO: it has to be relative rtpath, not bundle, name
exec 'runtime! '.a:bundle.name.'/plugin/*.vim'
exec 'runtime! '.a:bundle.name.'/after/*.vim'
call s:rtp_rm(g:bundle_dir)
endf
func! s:parse_options(opts) func! s:parse_options(opts)
" TODO: improve this " TODO: improve this
if len(a:opts) != 1 | return {} | endif if len(a:opts) != 1 | return {} | endif
@ -34,14 +42,6 @@ func! s:parse_name(arg)
return {'name': name, 'uri': uri } return {'name': name, 'uri': uri }
endf endf
func! s:require(bundle)
call s:rtp_add(g:bundle_dir)
" TODO: it has to be relative rtpath, not bundle, name
exec 'runtime! '.a:bundle.name.'/plugin/*.vim'
exec 'runtime! '.a:bundle.name.'/after/*.vim'
call s:rtp_rm(g:bundle_dir)
endf
func! s:rtp_rm(dir) func! s:rtp_rm(dir)
exec 'set rtp-='.a:dir exec 'set rtp-='.a:dir
exec 'set rtp-='.expand(a:dir.'/after') exec 'set rtp-='.expand(a:dir.'/after')

View File

@ -34,6 +34,7 @@ func! s:install(bang, bundle)
let synced = s:sync(a:bang, a:bundle) let synced = s:sync(a:bang, a:bundle)
call s:helptags(a:bundle.rtpath()) call s:helptags(a:bundle.rtpath())
call s:log(a:bundle.name.' '.(synced ? '': ' already').' installed') call s:log(a:bundle.name.' '.(synced ? '': ' already').' installed')
if synced | call vundle#config#require(a:bundle) | endif
endf endf
func! s:log(msg) func! s:log(msg)