From 4391eb35170f9d19ba484b3b8176e4222ce819b3 Mon Sep 17 00:00:00 2001 From: Rainux Luo Date: Fri, 21 Oct 2011 23:37:38 +0800 Subject: [PATCH] Introduce BundleBind! command to speed up Vim startup The performance issue was introduced in 55a5ef04. --- autoload/vundle.vim | 3 +++ autoload/vundle/config.vim | 7 +++++-- doc/vundle.txt | 11 +++++++++++ plugin/vundle.vim | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 plugin/vundle.vim diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 632a5b2..54586cc 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -7,6 +7,9 @@ com! -nargs=+ Bundle \ call vundle#config#bundle() +com! -nargs=0 -bang BundleBind +\ call vundle#config#bind() + com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall \ call vundle#installer#new('!' == '', ) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 65db652..0c02c1d 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -1,8 +1,11 @@ func! vundle#config#bundle(arg, ...) let bundle = vundle#config#init_bundle(a:arg, a:000) - call s:rtp_rm_a() call add(g:bundles, bundle) - call s:rtp_add_a() +endf + +func! vundle#config#bind() + call s:rtp_rm_a() + call vundle#config#require(g:bundles) endf func! vundle#config#init() diff --git a/doc/vundle.txt b/doc/vundle.txt index 8c10e8f..185eb90 100644 --- a/doc/vundle.txt +++ b/doc/vundle.txt @@ -108,6 +108,17 @@ equals full uri > NOTE: Vundle defaults to http:// protocol for the short URIs + *BundleBind!* +`Bundle` command just tell Vundle which scripts you want to use, it doesn't +tell Vim load them, i.e, it doesn't update the 'runtimepath' option of Vim. + +To tell Vim load your scripts, `BundleBind!` must be executed. But Vundle will +do it automatically, so usually you don't need to do it yourself. + +The benefit of use an extra command to update 'runtimepath' is, we can make +Vim startup much faster while keeping 'runtimepath' ordered according to the +bundles declarations. + 4.2 INSTALL SCRIPTS ~ *vundle-scripts-install* *BundleInstall* diff --git a/plugin/vundle.vim b/plugin/vundle.vim new file mode 100644 index 0000000..dc19532 --- /dev/null +++ b/plugin/vundle.vim @@ -0,0 +1,7 @@ +if exists('g:loaded_vundle') || &cp + finish +endif +let g:loaded_vundle = 1 + +" Bind and load all scripts bundles immediately. +BundleBind!