From e1b4ef5f0910dd51119c3f3dc21c1668d8d819da Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 8 Dec 2010 22:55:16 -0600 Subject: [PATCH] Require installed script - so it's ready to use right after installation --- autoload/vundle/config.vim | 18 +++++++++--------- autoload/vundle/installer.vim | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 37fee04..adef801 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -3,7 +3,7 @@ func! vundle#config#bundle(arg, ...) call extend(bundle, copy(s:bundle)) call add(g:bundles, bundle) call s:rtp_add(bundle.rtpath()) - call s:require(bundle) + call vundle#config#require(bundle) endf func! vundle#config#init() @@ -11,6 +11,14 @@ func! vundle#config#init() let g:bundles = [] 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) " TODO: improve this if len(a:opts) != 1 | return {} | endif @@ -34,14 +42,6 @@ func! s:parse_name(arg) return {'name': name, 'uri': uri } 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) exec 'set rtp-='.a:dir exec 'set rtp-='.expand(a:dir.'/after') diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 1a6034e..d5f221a 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -33,7 +33,8 @@ endf func! s:install(bang, bundle) let synced = s:sync(a:bang, a:bundle) 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 func! s:log(msg)