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

@ -1,17 +1,19 @@
func! vundle#config#bundle(arg, ...) func! vundle#config#bundle(arg, ...)
let bundle = vundle#config#init_bundle(a:arg, a:000) let bundle = vundle#config#init_bundle(a:arg, a:000)
if exists('g:vundle_lazy_load') && g:vundle_lazy_load if exists('g:vundle_lazy_load') && g:vundle_lazy_load
call add(g:bundles, bundle) call add(g:bundles, bundle)
else else
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()
call s:rtp_add_defaults()
endif endif
return bundle return bundle
endf endf
func! vundle#config#activate_bundles() func! vundle#config#activate_bundles()
call s:rtp_add_a() call s:rtp_add_a()
call s:rtp_add_defaults()
endf endf
func! vundle#config#init() func! vundle#config#init()
@ -29,6 +31,7 @@ func! vundle#config#require(bundles) abort
exec 'runtime! '.b.name.'/after/*.vim' exec 'runtime! '.b.name.'/after/*.vim'
call s:rtp_rm(g:bundle_dir) call s:rtp_rm(g:bundle_dir)
endfor endfor
call s:rtp_add_defaults()
endf endf
func! vundle#config#init_bundle(name, opts) func! vundle#config#init_bundle(name, opts)
@ -75,6 +78,22 @@ func! s:parse_name(arg)
return {'name': name, 'uri': uri, 'name_spec': arg } return {'name': name, 'uri': uri, 'name_spec': arg }
endf 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() func! s:rtp_rm_a()
let paths = map(copy(g:bundles), 'v:val.rtpath') let paths = map(copy(g:bundles), 'v:val.rtpath')
let prepends = join(paths, ',') let prepends = join(paths, ',')