Preserve rtp ordered according to Bundle declarations

- fixes https://github.com/gmarik/vundle/issues#issue/3
- TODO: not the most efficient approach
This commit is contained in:
gmarik 2011-01-09 22:27:59 -06:00
parent 79e2e58107
commit 55a5ef041c
2 changed files with 12 additions and 4 deletions

View File

@ -10,8 +10,6 @@ com! -nargs=0 BundleDocs call vundle#installer#helptags()
com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("<bang>", <q-args>) com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("<bang>", <q-args>)
if !exists('g:bundles') | let g:bundles = [] | endif
func! vundle#rc() func! vundle#rc()
let g:bundle_dir = expand('$HOME/.vim/bundle') let g:bundle_dir = expand('$HOME/.vim/bundle')
call vundle#config#init() call vundle#config#init()

View File

@ -1,14 +1,16 @@
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 = extend(s:parse_options(a:000), s:parse_name(a:arg))
call extend(bundle, copy(s:bundle)) call extend(bundle, copy(s:bundle))
call s:rtp_rm_a()
call add(g:bundles, bundle) call add(g:bundles, bundle)
call s:rtp_add(bundle.rtpath()) call s:rtp_add_a()
" TODO: fix this: explicit sourcing kills command-T " TODO: fix this: explicit sourcing kills command-T
" call vundle#config#require(bundle) " call vundle#config#require(bundle)
endf endf
func! vundle#config#init() 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 = [] let g:bundles = []
endf endf
@ -43,6 +45,14 @@ func! s:parse_name(arg)
return {'name': name, 'uri': uri } return {'name': name, 'uri': uri }
endf 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) func! s:rtp_rm(dir)
exec 'set rtp-='.a:dir exec 'set rtp-='.a:dir
exec 'set rtp-='.expand(a:dir.'/after') exec 'set rtp-='.expand(a:dir.'/after')