From 1a652c0cdf559222c2612ca6b84033a524de9919 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 10 Sep 2021 15:51:51 -0400 Subject: [PATCH] Tab complete :Git ++options and --options Resolves: https://github.com/tpope/vim-fugitive/issues/1833 --- autoload/fugitive.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index cf708b5..976b7ba 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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, '')