allow :BundleInstall script_name

This commit is contained in:
gmarik 2011-03-04 19:55:59 -06:00
parent 2df30b4c4f
commit 117ff5c27c
3 changed files with 22 additions and 13 deletions

View File

@ -5,9 +5,9 @@
" Version: 0.5 " Version: 0.5
com! -nargs=+ Bundle call vundle#config#bundle(<args>) com! -nargs=+ Bundle call vundle#config#bundle(<args>)
com! -nargs=? -bang BundleInstall call vundle#installer#install('!' == '<bang>') com! -nargs=? -bang BundleInstall call vundle#installer#install('!' == '<bang>', <q-args>)
com! -nargs=? -bang BundleClean call vundle#installer#clean('!' == '<bang>') com! -nargs=? -bang BundleClean call vundle#installer#clean('!' == '<bang>')
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('!' == '<bang>', <q-args>) com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search('!' == '<bang>', <q-args>)

View File

@ -1,6 +1,5 @@
func! vundle#config#bundle(arg, ...) func! vundle#config#bundle(arg, ...)
let bundle = extend(s:parse_options(a:000), s:parse_name(a:arg)) let bundle = vundle#config#init_bundle(a:arg, a:000)
call extend(bundle, copy(s:bundle))
call s:rtp_rm_a() call s:rtp_rm_a()
call add(g:bundles, bundle) call add(g:bundles, bundle)
call s:rtp_add_a() call s:rtp_add_a()
@ -23,6 +22,11 @@ func! vundle#config#require(bundle)
call s:rtp_rm(g:bundle_dir) call s:rtp_rm(g:bundle_dir)
endf 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) 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

View File

@ -1,16 +1,20 @@
func! vundle#installer#install(bang) func! vundle#installer#install(bang, ...)
call s:reload_bundles()
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif
for bundle in g:bundles | call s:install(a:bang, bundle) | endfor let bundles = (a:1 == '') ?
\ s:reload_bundles() :
call vundle#installer#helptags() \ 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 endf
func! vundle#installer#helptags() func! vundle#installer#helptags(bundles)
let bundle_dirs = map(copy(g:bundles),'v:val.rtpath()') let bundle_dirs = map(a:bundles,'v:val.rtpath()')
let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)') let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)')
call map(copy(help_dirs), 's:helptags(v:val)') call map(copy(help_dirs), 's:helptags(v:val)')
if len(help_dirs) > 0
call s:log('Helptags: done. '.len(help_dirs).' bundles processed') call s:log('Helptags: done. '.len(help_dirs).' bundles processed')
endif
endf endf
func! vundle#installer#clean(bang) func! vundle#installer#clean(bang)
@ -28,6 +32,7 @@ func! s:reload_bundles()
" TODO: obtain Bundles without sourcing .vimrc " TODO: obtain Bundles without sourcing .vimrc
silent source $MYVIMRC silent source $MYVIMRC
if filereadable($MYGVIMRC)| silent source $MYGVIMRC | endif if filereadable($MYGVIMRC)| silent source $MYGVIMRC | endif
return g:bundles
endf endf
func! s:has_doc(rtp) func! s:has_doc(rtp)