Handle default rtp values

This commit is contained in:
Jacobo de Vera 2014-04-07 01:39:10 +02:00 committed by Jeremy Pallats/starcraft.man
parent c20c90d867
commit 1736243c0e

View File

@ -6,12 +6,14 @@ func! vundle#config#bundle(arg, ...)
call s:rtp_rm_a()
call add(g:bundles, bundle)
call s:rtp_add_a()
call s:rtp_add_defaults()
endif
return bundle
endf
func! vundle#config#activate_bundles()
call s:rtp_add_a()
call s:rtp_add_defaults()
endf
func! vundle#config#init()
@ -29,6 +31,7 @@ func! vundle#config#require(bundles) abort
exec 'runtime! '.b.name.'/after/*.vim'
call s:rtp_rm(g:bundle_dir)
endfor
call s:rtp_add_defaults()
endf
func! vundle#config#init_bundle(name, opts)
@ -75,6 +78,22 @@ func! s:parse_name(arg)
return {'name': name, 'uri': uri, 'name_spec': arg }
endf
func! s:rtp_add_defaults()
let current = &rtp
set rtp&vim
let default = &rtp
let &rtp = current
for item in reverse(split(default, ','))
exec 'set rtp-=' . item
if fnamemodify(item, ":t") == 'after'
exec 'set rtp+=' . item
else
exec 'set rtp^=' . item
endif
endfor
endf
func! s:rtp_rm_a()
let paths = map(copy(g:bundles), 'v:val.rtpath')
let prepends = join(paths, ',')