diff --git a/README.md b/README.md index 508b266..a7b5448 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ Bundle 'file:///Users/gmarik/path/to/plugin' " ... + " Installs bundle only if vim version matches + BundleIf '703.584', 'Valloric/YouCompleteMe' + filetype plugin indent on " required! " " Brief help 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 5bb6e3f..cea1742 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -6,6 +6,19 @@ func! vundle#config#bundle(arg, ...) return bundle endf +func! vundle#config#bundle_if(arg, ...) + let versions = split(a:arg, '\.') + if len(versions) == 2 + 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] + call vundle#config#bundle(join(a:000)) + endif + endif +endf + func! vundle#config#init() if !exists('g:bundles') | let g:bundles = [] | endif call s:rtp_rm_a()