From 1e140c9f6b5c1c2b9c3a6c01723b3d627b56fb31 Mon Sep 17 00:00:00 2001 From: gmarik Date: Sun, 29 Apr 2012 00:24:01 -0500 Subject: [PATCH] change &rtp manipulation - make it append only (instead both append + prepend) - which draws *_rm_a and *_add_a useless as &rtp order gets preserved - benefits: simpler, faster, less code --- autoload/vundle/config.vim | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 55c7d7d..3ed0cf8 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -1,14 +1,13 @@ func! vundle#config#bundle(arg, ...) let bundle = vundle#config#init_bundle(a:arg, a:000) - call s:rtp_rm_a() + call s:rtp_rm(bundle.rtpath) call add(g:bundles, bundle) - call s:rtp_add_a() + call s:rtp_add(bundle.rtpath) return bundle endf func! vundle#config#init() if !exists('g:bundles') | let g:bundles = [] | endif - call s:rtp_rm_a() let g:bundles = [] endf @@ -64,30 +63,17 @@ func! s:parse_name(arg) return {'name': name, 'uri': uri, 'name_spec': arg } endf -func! s:rtp_rm_a() - let paths = map(copy(g:bundles), 'v:val.rtpath') - let prepends = join(paths, ',') - let appends = join(paths, '/after,').'/after' - exec 'set rtp-='.fnameescape(prepends) - exec 'set rtp-='.fnameescape(appends) -endf - -func! s:rtp_add_a() - let paths = map(copy(g:bundles), 'v:val.rtpath') - let prepends = join(paths, ',') - let appends = join(paths, '/after,').'/after' - exec 'set rtp^='.fnameescape(prepends) - exec 'set rtp+='.fnameescape(appends) -endf - func! s:rtp_rm(dir) abort exec 'set rtp-='.fnameescape(expand(a:dir, 1)) exec 'set rtp-='.fnameescape(expand(a:dir.'/after', 1)) endf func! s:rtp_add(dir) abort - exec 'set rtp^='.fnameescape(expand(a:dir, 1)) - exec 'set rtp+='.fnameescape(expand(a:dir.'/after', 1)) + exec 'set rtp+='.fnameescape(expand(a:dir, 1)) + let after_dir = expand(a:dir.'/after', 1) + if isdirectory(after_dir) + exec 'set rtp+='.fnameescape(after_dir) + end endf func! s:expand_path(path) abort