mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 06:13:51 -05:00
Tab complete :Git ++options and --options
Resolves: https://github.com/tpope/vim-fugitive/issues/1833
This commit is contained in:
@@ -3811,8 +3811,12 @@ function! fugitive#Complete(lead, ...) abort
|
||||
let dir = a:0 == 1 ? a:1 : a:0 >= 3 ? s:Dir(a:3) : s:Dir()
|
||||
let root = a:0 >= 4 ? a:4 : s:Tree(s:Dir())
|
||||
let pre = a:0 > 1 ? strpart(a:1, 0, a:2) : ''
|
||||
let subcmd = matchstr(pre, '\u\w*[! ] *\zs[[:alnum:]-]\+\ze ')
|
||||
if empty(subcmd)
|
||||
let subcmd = matchstr(pre, '\u\w*[! ] *\%(\%(++\S\+\|--\S\+-pathspecs\|-c\s\+\S\+\)\s\+\)*\zs[[:alnum:]][[:alnum:]-]*\ze ')
|
||||
if empty(subcmd) && a:lead =~# '^+'
|
||||
let results = ['++curwin']
|
||||
elseif empty(subcmd) && a:lead =~# '^-'
|
||||
let results = ['--literal-pathspecs', '--no-literal-pathspecs', '--glob-pathspecs', '--noglob-pathspecs', '--icase-pathspecs', '--no-optional-locks']
|
||||
elseif empty(subcmd)
|
||||
let results = s:CompletableSubcommands(dir)
|
||||
elseif a:0 ==# 2 && subcmd =~# '^\%(commit\|revert\|push\|fetch\|pull\|merge\|rebase\)$'
|
||||
let cmdline = substitute(a:1, '\u\w*\([! ] *\)' . subcmd, 'G' . subcmd, '')
|
||||
|
||||
Reference in New Issue
Block a user