It's better now!

This commit is contained in:
gmarik 2010-10-31 22:02:20 -05:00
parent a952336487
commit c360d43c07

View File

@ -8,40 +8,39 @@ let g:vundle_loaded = 1
au BufRead,BufNewFile {bundlerc} set ft=vim au BufRead,BufNewFile {bundlerc} set ft=vim
com! -nargs=+ Bundle call vundle#new_bundle(<args>) com! -nargs=+ Bundle call vundle#add_bundle(<args>)
com! -nargs=0 BundleInstall call vundle#install_bundles() com! -nargs=0 BundleInstall call vundle#install_bundles()
com! -nargs=0 BundleDocs call vundle#helptagify_bundles() com! -nargs=0 BundleDocs call vundle#helptagify_bundles()
let g:bundle_dir = expand('~/.vim/bundle/') let g:bundle_dir = expand('~/.vim/bundle/')
func! vundle#add_bundle(uri, opts) func! vundle#rc()
let g:bundles = []
endf
func! vundle#add_bundle(...)
let [uri; rest] = a:000 | let opts = {}
if len(rest) == 1 | let opts = rest[0] | endif
let bundle = vundle#new_bundle(uri, opts)
call vundle#require_bundle(bundle)
endf
func! vundle#new_bundle(uri, opts)
let bundle = a:opts let bundle = a:opts
let bundle.uri = a:uri let bundle.uri = a:uri
let bundle.name = split(a:uri,'\/')[-1] " potentially break on Windows let bundle.name = split(a:uri,'\/')[-1]
let bundle.path = expand(g:bundle_dir.''.bundle.name) let bundle.path = expand(g:bundle_dir.''.bundle.name)
let bundle.rtpath = has_key(bundle, 'rtp') ? join([bundle.path, bundle.rtp], '/') : bundle.path let bundle.rtpath = has_key(bundle, 'rtp') ? join([bundle.path, bundle.rtp], '/') : bundle.path
call add(g:bundles, bundle) call add(g:bundles, bundle)
return bundle return bundle
endf endf
func! vundle#new_bundle(...)
let [uri; rest] = a:000 | let opts = {}
if len(rest) == 1 | let opts = rest[0] | endif
let bundle = vundle#add_bundle(uri, opts)
call vundle#require_bundle(bundle)
endf
func! vundle#rc()
let &rtp = join(filter(split(&rtp, ','),'v:val !~# g:bundle_dir'), ',')
let g:bundles = []
endf
func! vundle#require_bundle(bundle) func! vundle#require_bundle(bundle)
let rtp = filter(split(&rtp, ','),'v:val !~# a:bundle.path') let dir = a:bundle.rtpath
let after = [] | let before = [] exec 'set rtp^='.dir
let path = s:RuntimePath(a:bundle) let after = expand(dir.'/after') | if isdirectory(after)
let before += path[0] | let after += path[1] exec 'set rtp+='.after
let &rtp = join(before + rtp + after, ',') endif
endf endf
func! vundle#install_bundles() func! vundle#install_bundles()
@ -69,10 +68,3 @@ func! vundle#helptagify_bundles()
endif endif
endfor endfor
endf endf
func! s:RuntimePath(bundle)
let before = [a:bundle.rtpath] | let after = []
let after_dir = expand(a:bundle.rtpath.'/'.'after')
if isdirectory(after_dir) | let after = [after_dir] | endif
return [before, after]
endf