diff --git a/autoload/vundle.vim b/autoload/vundle.vim index d4648da..e116352 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -10,8 +10,6 @@ com! -nargs=0 BundleDocs call vundle#installer#helptags() com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("", ) -if !exists('g:bundles') | let g:bundles = [] | endif - func! vundle#rc() let g:bundle_dir = expand('$HOME/.vim/bundle') call vundle#config#init() diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index eb2d704..c50dded 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -1,14 +1,16 @@ func! vundle#config#bundle(arg, ...) let bundle = extend(s:parse_options(a:000), s:parse_name(a:arg)) call extend(bundle, copy(s:bundle)) + call s:rtp_rm_a() call add(g:bundles, bundle) - call s:rtp_add(bundle.rtpath()) + call s:rtp_add_a() " TODO: fix this: explicit sourcing kills command-T " call vundle#config#require(bundle) endf func! vundle#config#init() - call filter(g:bundles, 's:rtp_rm(v:val.rtpath())') + if !exists('g:bundles') | let g:bundles = [] | endif + call s:rtp_rm_a() let g:bundles = [] endf @@ -43,6 +45,14 @@ func! s:parse_name(arg) return {'name': name, 'uri': uri } endf +func! s:rtp_rm_a() + for b in g:bundles | call s:rtp_rm(b.rtpath()) | endfor +endf + +func! s:rtp_add_a() + for b in reverse(copy(g:bundles)) | call s:rtp_add(b.rtpath()) | endfor +endf + func! s:rtp_rm(dir) exec 'set rtp-='.a:dir exec 'set rtp-='.expand(a:dir.'/after')