diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index b326541..a566e22 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -341,13 +341,17 @@ let s:config = {} function! fugitive#Config(...) abort let dir = get(b:, 'git_dir', '') let name = '' - if len(a:000) >= 2 - let dir = a:000[1] - let name = a:000[0] - elseif len(a:000) == 1 && a:000[0] =~# '^[[:alnum:]-]\+\.' - let name = a:000[0] - elseif len(a:000) == 1 - let dir = a:000[0] + if a:0 >= 2 && type(a:2) == type({}) + return len(a:1) ? get(get(a:2, a:1, []), 0, '') : a:2 + elseif a:0 >= 2 + let dir = a:2 + let name = a:1 + elseif a:0 == 1 && type(a:1) == type({}) + return a:1 + elseif a:0 == 1 && a:1 =~# '^[[:alnum:]-]\+\.' + let name = a:1 + elseif a:0 == 1 + let dir = a:1 endif let key = len(dir) ? dir : '_' if has_key(s:config, key) && s:config[key][0] ==# s:ConfigTimestamps(dir, s:config[key][1]) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 4cc2d83..bff7702 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -73,10 +73,10 @@ function! FugitivePrepare(...) abort endfunction function! FugitiveConfig(...) abort - if len(a:000) == 2 - return fugitive#Config(a:000[1], FugitiveGitDir(a:000[2])) - elseif len(a:000) == 1 && a:000[0] !~# '^[[:alnum:]-]\+\.' - return fugitive#Config(FugitiveGitDir(a:000[0])) + if a:0 == 2 && type(a:2) != type({}) + return fugitive#Config(a:1, FugitiveGitDir(a:2)) + elseif a:0 == 1 && a:1 !~# '^[[:alnum:]-]\+\.' + return fugitive#Config(FugitiveGitDir(a:1)) else return call('fugitive#Config', a:000) endif