Browse Source

Merge f72a8c83bb into 59bff0c457

pull/181/merge
GitHub Merge Button 14 years ago
parent
commit
42aa06bc27
2 changed files with 29 additions and 10 deletions
  1. +1
    -1
      autoload/vundle.vim
  2. +28
    -9
      autoload/vundle/config.vim

+ 1
- 1
autoload/vundle.vim View File

@ -5,7 +5,7 @@
" Version: 0.9 " Version: 0.9
com! -nargs=+ Bundle com! -nargs=+ Bundle
\ call vundle#config#bundle(<args>)
\ call vundle#config#bundle(<f-args>)
com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall
\ call vundle#installer#new('!' == '<bang>', <q-args>) \ call vundle#installer#new('!' == '<bang>', <q-args>)


+ 28
- 9
autoload/vundle/config.vim View File

@ -24,7 +24,7 @@ func! vundle#config#require(bundles) abort
endf endf
func! vundle#config#init_bundle(name, opts) func! vundle#config#init_bundle(name, opts)
let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')))
let opts = extend(s:parse_options(split( substitute( join(a:opts),"['".'"]\+','','g') )), s:parse_name(substitute(a:name,"['".'"]\+','','g')))
let b = extend(opts, copy(s:bundle)) let b = extend(opts, copy(s:bundle))
let b.rtpath = s:rtpath(opts) let b.rtpath = s:rtpath(opts)
return b return b
@ -32,13 +32,25 @@ endf
func! s:parse_options(opts) func! s:parse_options(opts)
" TODO: improve this " TODO: improve this
if len(a:opts) != 1 | return {} | endif
if type(a:opts[0]) == type({})
return a:opts[0]
else
return {'rev': a:opts[0]}
endif
let parsed_opts = {}
for opt in a:opts
if type(opt) == type({})
" already a dict
call extend( parsed_opts, opt )
elseif type(opt) == type("")
" a string. detect delimiter
if opt =~? '\S\+=\S\+' " is it a '='
let [key,val] = split( opt, '=' )
elseif opt =~? '\S\+:\S\+' " is it a ':'
let [key,val] = split( opt, ':' )
else
let key = 'could_not_parse'
let val = opt
endif
let parsed_opts[key] = val
endif
endfor
return parsed_opts
endf endf
func! s:parse_name(arg) func! s:parse_name(arg)
@ -95,7 +107,14 @@ func! s:expand_path(path) abort
endf endf
func! s:rtpath(opts) func! s:rtpath(opts)
return has_key(a:opts, 'rtp') ? s:expand_path(a:opts.path().'/'.a:opts.rtp) : a:opts.path()
if has_key(a:opts, 'rtp') " check if user set rtp
return s:expand_path(a:opts.path().'/'.a:opts.rtp)
elseif has_key(a:opts, 'rtpath') " check if user set rtpath
return s:expand_path(a:opts.path().'/'.a:opts.rtpath)
else
" default to the bundles path
return has_key(a:opts, 'rtp') ? s:expand_path(a:opts.path().'/'.a:opts.rtp) : a:opts.path()
endif
endf endf
let s:bundle = {} let s:bundle = {}


Loading…
Cancel
Save