diff --git a/autoload/vundle.vim b/autoload/vundle.vim index fcbcb62..887685b 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -5,9 +5,9 @@ " Version: 0.5 com! -nargs=+ Bundle call vundle#config#bundle() -com! -nargs=? -bang BundleInstall call vundle#installer#install('!' == '') +com! -nargs=? -bang BundleInstall call vundle#installer#install('!' == '', ) com! -nargs=? -bang BundleClean call vundle#installer#clean('!' == '') -com! -nargs=0 BundleDocs call vundle#installer#helptags() +com! -nargs=0 BundleDocs call vundle#installer#helptags(g:bundles) com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search('!' == '', ) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 9569793..1209a33 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -1,6 +1,5 @@ func! vundle#config#bundle(arg, ...) - let bundle = extend(s:parse_options(a:000), s:parse_name(a:arg)) - call extend(bundle, copy(s:bundle)) + 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() @@ -23,10 +22,15 @@ func! vundle#config#require(bundle) call s:rtp_rm(g:bundle_dir) endf +func! vundle#config#init_bundle(name, opts) + let opts = extend(s:parse_options(a:opts), s:parse_name(a:name)) + return extend(opts, copy(s:bundle)) +endf + func! s:parse_options(opts) " TODO: improve this if len(a:opts) != 1 | return {} | endif - + if type(a:opts[0]) == type({}) return a:opts[0] else diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 3330e29..639b23f 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -1,16 +1,20 @@ -func! vundle#installer#install(bang) - call s:reload_bundles() +func! vundle#installer#install(bang, ...) if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif - for bundle in g:bundles | call s:install(a:bang, bundle) | endfor - - call vundle#installer#helptags() + let bundles = (a:1 == '') ? + \ s:reload_bundles() : + \ map(copy(a:000), 'vundle#config#init_bundle(v:val, {})') + call s:log(bundles) + for bundle in bundles | call s:install(a:bang, bundle) | endfor + call vundle#installer#helptags(bundles) endf -func! vundle#installer#helptags() - let bundle_dirs = map(copy(g:bundles),'v:val.rtpath()') +func! vundle#installer#helptags(bundles) + let bundle_dirs = map(a:bundles,'v:val.rtpath()') let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)') call map(copy(help_dirs), 's:helptags(v:val)') - call s:log('Helptags: done. '.len(help_dirs).' bundles processed') + if len(help_dirs) > 0 + call s:log('Helptags: done. '.len(help_dirs).' bundles processed') + endif endf func! vundle#installer#clean(bang) @@ -28,6 +32,7 @@ func! s:reload_bundles() " TODO: obtain Bundles without sourcing .vimrc silent source $MYVIMRC if filereadable($MYGVIMRC)| silent source $MYGVIMRC | endif + return g:bundles endf func! s:has_doc(rtp)