mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 06:13:51 -05:00
Expose completion helpers for subcommands
This commit is contained in:
@@ -3335,7 +3335,7 @@ function! s:RevertSubcommand(line1, line2, range, bang, mods, args) abort
|
|||||||
return s:CommitSubcommand(a:line1, a:line2, a:range, a:bang, a:mods, [], dir)
|
return s:CommitSubcommand(a:line1, a:line2, a:range, a:bang, a:mods, [], dir)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:CommitComplete(A, L, P) abort
|
function! fugitive#CommitComplete(A, L, P) abort
|
||||||
if a:A =~# '^--fixup=\|^--squash='
|
if a:A =~# '^--fixup=\|^--squash='
|
||||||
let commits = s:LinesError(['log', '--pretty=format:%s', '@{upstream}..'])[0]
|
let commits = s:LinesError(['log', '--pretty=format:%s', '@{upstream}..'])[0]
|
||||||
let pre = matchstr(a:A, '^--\w*=''\=') . ':/^'
|
let pre = matchstr(a:A, '^--\w*=''\=') . ':/^'
|
||||||
@@ -3352,7 +3352,7 @@ function! s:CommitComplete(A, L, P) abort
|
|||||||
return []
|
return []
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:RevertComplete(A, L, P) abort
|
function! fugitive#RevertComplete(A, L, P) abort
|
||||||
return s:CompleteSub('revert', a:A, a:L, a:P, function('s:CompleteRevision'))
|
return s:CompleteSub('revert', a:A, a:L, a:P, function('s:CompleteRevision'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -3370,20 +3370,20 @@ function! s:FinishCommit() abort
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:command("-nargs=? -range=-1 -complete=customlist,s:CommitComplete Gcommit", "commit")
|
call s:command("-nargs=? -range=-1 -complete=customlist,fugitive#CommitComplete Gcommit", "commit")
|
||||||
call s:command("-nargs=? -range=-1 -complete=customlist,s:RevertComplete Grevert", "revert")
|
call s:command("-nargs=? -range=-1 -complete=customlist,fugitive#RevertComplete Grevert", "revert")
|
||||||
|
|
||||||
" Section: :Gmerge, :Grebase, :Gpull
|
" Section: :Gmerge, :Grebase, :Gpull
|
||||||
|
|
||||||
function! s:MergeComplete(A, L, P) abort
|
function! fugitive#MergeComplete(A, L, P) abort
|
||||||
return s:CompleteSub('merge', a:A, a:L, a:P, function('s:CompleteRevision'))
|
return s:CompleteSub('merge', a:A, a:L, a:P, function('s:CompleteRevision'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:RebaseComplete(A, L, P) abort
|
function! fugitive#RebaseComplete(A, L, P) abort
|
||||||
return s:CompleteSub('rebase', a:A, a:L, a:P, function('s:CompleteRevision'))
|
return s:CompleteSub('rebase', a:A, a:L, a:P, function('s:CompleteRevision'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:PullComplete(A, L, P) abort
|
function! fugitive#PullComplete(A, L, P) abort
|
||||||
return s:CompleteSub('pull', a:A, a:L, a:P, function('s:CompleteRemote'))
|
return s:CompleteSub('pull', a:A, a:L, a:P, function('s:CompleteRemote'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -3650,9 +3650,9 @@ augroup fugitive_merge
|
|||||||
\ endif
|
\ endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
call s:command("-nargs=? -bang -complete=customlist,s:MergeComplete Gmerge", "merge")
|
call s:command("-nargs=? -bang -complete=customlist,fugitive#MergeComplete Gmerge", "merge")
|
||||||
call s:command("-nargs=? -bang -complete=customlist,s:RebaseComplete Grebase", "rebase")
|
call s:command("-nargs=? -bang -complete=customlist,fugitive#RebaseComplete Grebase", "rebase")
|
||||||
call s:command("-nargs=? -bang -complete=customlist,s:PullComplete Gpull", "pull")
|
call s:command("-nargs=? -bang -complete=customlist,fugitive#PullComplete Gpull", "pull")
|
||||||
|
|
||||||
" Section: :Ggrep, :Glog
|
" Section: :Ggrep, :Glog
|
||||||
|
|
||||||
@@ -4203,11 +4203,11 @@ augroup END
|
|||||||
|
|
||||||
" Section: :Gpush, :Gfetch
|
" Section: :Gpush, :Gfetch
|
||||||
|
|
||||||
function! s:PushComplete(A, L, P) abort
|
function! fugitive#PushComplete(A, L, P) abort
|
||||||
return s:CompleteSub('push', a:A, a:L, a:P, function('s:CompleteRemote'))
|
return s:CompleteSub('push', a:A, a:L, a:P, function('s:CompleteRemote'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:FetchComplete(A, L, P) abort
|
function! fugitive#FetchComplete(A, L, P) abort
|
||||||
return s:CompleteSub('fetch', a:A, a:L, a:P, function('s:CompleteRemote'))
|
return s:CompleteSub('fetch', a:A, a:L, a:P, function('s:CompleteRemote'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -4260,8 +4260,8 @@ function! s:FetchSubcommand(line1, line2, range, bang, mods, args) abort
|
|||||||
return s:Dispatch(a:bang ? '!' : '', 'fetch', a:args)
|
return s:Dispatch(a:bang ? '!' : '', 'fetch', a:args)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:command("-nargs=? -bang -complete=customlist,s:PushComplete Gpush", "push")
|
call s:command("-nargs=? -bang -complete=customlist,fugitive#PushComplete Gpush", "push")
|
||||||
call s:command("-nargs=? -bang -complete=customlist,s:FetchComplete Gfetch", "fetch")
|
call s:command("-nargs=? -bang -complete=customlist,fugitive#FetchComplete Gfetch", "fetch")
|
||||||
|
|
||||||
" Section: :Gdiff
|
" Section: :Gdiff
|
||||||
|
|
||||||
@@ -4667,7 +4667,7 @@ function! s:BlameQuit() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:BlameComplete(A, L, P) abort
|
function! fugitive#BlameComplete(A, L, P) abort
|
||||||
return s:CompleteSub('blame', a:A, a:L, a:P)
|
return s:CompleteSub('blame', a:A, a:L, a:P)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -5093,7 +5093,7 @@ augroup fugitive_blame
|
|||||||
autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('<abuf>')), 'fugitive_leave')
|
autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('<abuf>')), 'fugitive_leave')
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
call s:command('-buffer -bang -range=-1 -nargs=? -complete=customlist,s:BlameComplete Gblame', 'blame')
|
call s:command('-buffer -bang -range=-1 -nargs=? -complete=customlist,fugitive#BlameComplete Gblame', 'blame')
|
||||||
|
|
||||||
" Section: :Gbrowse
|
" Section: :Gbrowse
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user