mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-11 04:53:45 -05:00
Use :Gsubcmd completion for :Git subcmd
This commit is contained in:
@@ -2581,6 +2581,10 @@ function! fugitive#Complete(lead, ...) abort
|
||||
let subcmd = matchstr(pre, '\u\w*[! ] *\zs[[:alnum:]-]\+\ze ')
|
||||
if empty(subcmd)
|
||||
let results = sort(s:Subcommands() + keys(s:Aliases(dir)))
|
||||
elseif a:0 ==# 2 && subcmd =~# '^\%(commit\|revert\|push\|fetch\|pull\|merge\|rebase\)$'
|
||||
let cmdline = substitute(a:1, '\u\w*\([! ] *\)' . subcmd, 'G' . subcmd, '')
|
||||
let caps_subcmd = substitute(subcmd, '\%(^\|-\)\l', '\u&', 'g')
|
||||
return fugitive#{caps_subcmd}Complete(a:lead, cmdline, a:2 + len(cmdline) - len(a:1))
|
||||
elseif pre =~# ' -- '
|
||||
return fugitive#CompletePath(a:lead, dir)
|
||||
elseif a:lead =~# '^-'
|
||||
|
||||
Reference in New Issue
Block a user