From 93bf5988abcef44a7b1a2dc5e6938c2b09e21b67 Mon Sep 17 00:00:00 2001 From: Rainux Luo Date: Sat, 22 Oct 2011 00:14:10 +0800 Subject: [PATCH] Refactor to reduce g:bundles usage in internal functions --- autoload/vundle/config.vim | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 0c02c1d..74d4363 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -4,21 +4,19 @@ func! vundle#config#bundle(arg, ...) endf func! vundle#config#bind() - call s:rtp_rm_a() + call s:rtp_rm(g:bundles) call vundle#config#require(g:bundles) endf func! vundle#config#init() if exists('g:bundles') - call s:rtp_rm_a() + call s:rtp_rm(g:bundles) endif let g:bundles = [] endf func! vundle#config#require(bundles) abort - for b in a:bundles - call s:rtp_add(b) - endfor + call s:rtp_add(a:bundles) " It's OK to do this since every plugin prevent itself be loaded twice runtime! plugin/*.vim runtime! after/*.vim @@ -74,14 +72,18 @@ func! s:rtp_add_a() call filter(reverse(copy(g:bundles)), 's:rtp_add(v:val)') endf -func! s:rtp_rm(bundle) abort - exec 'set rtp-='.a:bundle.escaped_rtpath - exec 'set rtp-='.a:bundle.escaped_rtpath_after +func! s:rtp_rm(bundles) abort + for bundle in a:bundles + exec 'set rtp-='.bundle.escaped_rtpath + exec 'set rtp-='.bundle.escaped_rtpath_after + endfor endf -func! s:rtp_add(bundle) abort - exec 'set rtp^='.a:bundle.escaped_rtpath - exec 'set rtp+='.a:bundle.escaped_rtpath_after +func! s:rtp_add(bundles) abort + for bundle in reverse(copy(a:bundles)) + exec 'set rtp^='.bundle.escaped_rtpath + exec 'set rtp+='.bundle.escaped_rtpath_after + endfor endf func! s:expand_path(path) abort