From 0b504180ee2497d42577a10eb8e54e3e2e932182 Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Wed, 6 Mar 2013 04:57:26 +0000 Subject: [PATCH 1/4] Added function to install bundle only if vim version matches --- autoload/vundle.vim | 4 ++++ autoload/vundle/config.vim | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 0bc7bf5..7d6e958 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -7,6 +7,10 @@ com! -nargs=+ Bundle \ call vundle#config#bundle() +com! -nargs=+ BundleIf +\ call vundle#config#bundle_if() + + com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall \ call vundle#installer#new('!' == '', ) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 55c7d7d..d55f2eb 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -6,6 +6,15 @@ func! vundle#config#bundle(arg, ...) return bundle endf +func! vundle#config#bundle_if(arg, ...) + let versions = split(a:arg, '\.') + if v:version == versions[0] && has(join(['patch',versions[1]],'')) + echom 'installing bundle' + echom join(a:000) + call vundle#config#bundle(join(a:000)) + endif +endf + func! vundle#config#init() if !exists('g:bundles') | let g:bundles = [] | endif call s:rtp_rm_a() From 946c09772b1c9ba6cad5991c8d574760198eaa65 Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Wed, 6 Mar 2013 04:59:02 +0000 Subject: [PATCH 2/4] Added description --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 02bba7f..bcef929 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,9 @@ Bundle 'git://git.wincent.com/command-t.git' " ... + " Installs bundle only if vim version matches + BundleIf '703.584', 'Valloric/YouCompleteMe' + filetype plugin indent on " required! " " Brief help From 46f0a5b6b3de15e3f5febafce2d795ba65d2ca7d Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Wed, 6 Mar 2013 05:01:45 +0000 Subject: [PATCH 3/4] Added conditional for only vim main version --- autoload/vundle/config.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index d55f2eb..ff7bed6 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -8,10 +8,18 @@ endf func! vundle#config#bundle_if(arg, ...) let versions = split(a:arg, '\.') - if v:version == versions[0] && has(join(['patch',versions[1]],'')) - echom 'installing bundle' - echom join(a:000) - call vundle#config#bundle(join(a:000)) + if len(versions) == 2 + if v:version == versions[0] && has(join(['patch',versions[1]],'')) + echom 'installing bundle' + echom join(a:000) + call vundle#config#bundle(join(a:000)) + endif + else + if v:version == versions[0] + echom 'installing bundle' + echom join(a:000) + call vundle#config#bundle(join(a:000)) + endif endif endf From 58748ea0cb9555622f3effa66abbb9618f34283b Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Fri, 8 Mar 2013 00:32:57 +0000 Subject: [PATCH 4/4] Better conditional logic and removed debug print --- autoload/vundle/config.vim | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index ff7bed6..c8bd6c5 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -9,15 +9,11 @@ endf func! vundle#config#bundle_if(arg, ...) let versions = split(a:arg, '\.') if len(versions) == 2 - if v:version == versions[0] && has(join(['patch',versions[1]],'')) - echom 'installing bundle' - echom join(a:000) + if v:version > versions[0] || v:version == versions[0] && has(join(['patch',versions[1]],'')) call vundle#config#bundle(join(a:000)) endif else - if v:version == versions[0] - echom 'installing bundle' - echom join(a:000) + if v:version >= versions[0] call vundle#config#bundle(join(a:000)) endif endif