diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 3aa6a6c..7fa4a96 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3659,11 +3659,11 @@ if !exists('g:fugitive_summary_format') let g:fugitive_summary_format = '%s' endif -function! s:GrepComplete(A, L, P) abort +function! fugitive#GrepComplete(A, L, P) abort return s:CompleteSub('grep', a:A, a:L, a:P) endfunction -function! s:LogComplete(A, L, P) abort +function! fugitive#LogComplete(A, L, P) abort return s:CompleteSub('log', a:A, a:L, a:P) endfunction @@ -3806,7 +3806,7 @@ function! s:LogParse(state, dir, line) abort return [] endfunction -function! s:Log(type, bang, line1, count, args, legacy) abort +function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort let dir = s:Dir() exe s:DirCheck(dir) let listnr = a:type =~# '^l' ? 0 : -1 @@ -3877,19 +3877,12 @@ function! s:Log(type, bang, line1, count, args, legacy) abort \ args + paths + extra) let state.target = path let title = (listnr < 0 ? ':Gclog ' : ':Gllog ') . s:fnameescape(args + paths) - if empty(paths + extra) && a:legacy && len(s:Relative('/')) + if empty(paths + extra) && empty(a:type) && len(s:Relative('/')) let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after endif return s:QuickfixStream(listnr, title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after endfunction -call s:command("-bang -nargs=? -range=-1 -addr=windows -complete=customlist,s:GrepComplete Ggrep", "grep") -call s:command("-bang -nargs=? -complete=customlist,s:GrepComplete Gcgrep :execute s:GrepSubcommand(-1, -1, 0, 0, '', )") -call s:command("-bang -nargs=? -complete=customlist,s:GrepComplete Glgrep :execute s:GrepSubcommand(0, 0, 0, 0, '', )") -call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Glog :exe s:Log('c',0,,,, 1)") -call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gclog :exe s:Log('c',0,,,, 0)") -call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gllog :exe s:Log('l',0,,,, 0)") - " Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread function! s:UsableWin(nr) abort diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 2c8a452..e86fc0a 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -359,12 +359,21 @@ augroup END let s:addr_other = has('patch-8.1.560') ? '-addr=other' : '' let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : '' +let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : '' exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete G exe fugitive#Command(, , +"", 0, "", )' exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete Git exe fugitive#Command(, , +"", 0, "", )' exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(, 0)" exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(, 1)" +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#Command(, , +"", 0, "", "grep " . )' +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#Command(, , +"", 0, "", "grep " . )' +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#Command(0, > 0 ? : 0, +"", 0, "", "grep " . )' + +exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(,,+"",0,, "")' +exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(,,+"",0,"",, "c")' +exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(,,+"",0,"",, "l")' + exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Ge exe fugitive#Open("edit", 0, "", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gedit exe fugitive#Open("edit", 0, "", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", 0, "", , [])'