From 415a44d0f854fc267727b6b594c793bf81b41704 Mon Sep 17 00:00:00 2001 From: gmarik Date: Sat, 7 May 2011 04:55:09 -0500 Subject: [PATCH] try to find configured bundle first - neccessary for Bundle! configured bundles havin custom settings - fallback to default behav in case not found --- autoload/vundle/installer.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 8174145..3640460 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -2,7 +2,7 @@ func! vundle#installer#install(bang, ...) abort if !isdirectory(g:vundle#bundle_dir) | call mkdir(g:vundle#bundle_dir, 'p') | endif let bundles = (a:1 == '') ? \ s:reload_bundles() : - \ map(copy(a:000), 'vundle#config#init_bundle(v:val, {})') + \ [s:find_or_init_by_name(a:1)] let cwd = getcwd() let new_bundles = [] @@ -35,6 +35,15 @@ func! vundle#installer#install(bang, ...) abort call s:doautocmd('BundlesInstallPost', 'vundle#bundle') endf +" TODO: improve this +func! s:find_or_init_by_name(name) + let matches = filter(copy(g:vundle#bundles), 'v:val.name == a:name') + if (!empty(matches)) + return matches[0] "assuming only 1 match may happen + endif + return vundle#config#init_bundle(0, a:name, {}) +endf + " TODO: verify whether autocommand already exists " verbose autocmd User BundleInstall* func! s:doautocmd(event, augroup_name)