From 9118ed27c357d66d8439e984cb5de247a0290be6 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 2 Aug 2019 13:05:01 -0400 Subject: [PATCH] Add -addr= declarations --- autoload/fugitive.vim | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index d98eb57..2105cd6 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -591,10 +591,17 @@ endfunction let s:commands = [] function! s:command(definition, ...) abort + let def = a:definition + if !has('patch-7.4.542') + let def = substitute(def, '-addr=\S\+ ', '', '') + endif + if !has('patch-8.1.560') + let def = substitute(def, '-addr=other ', '', '') + endif if a:0 - call add(s:commands, a:definition . ' execute s:Command(' . string(a:1) . ", , , +'', 0, '', , [])") + call add(s:commands, def . ' execute s:Command(' . string(a:1) . ", , , +'', 0, '', , [])") else - call add(s:commands, a:definition) + call add(s:commands, def) endif endfunction @@ -2168,8 +2175,8 @@ function! fugitive#Complete(...) abort return call('fugitive#CompleteGit', a:000) endfunction -call s:command("-bang -nargs=? -range=-1 -complete=customlist,fugitive#CompleteGit Git", "Git") -call s:command("-bang -nargs=? -range=-1 -complete=customlist,fugitive#CompleteGit G", "Git") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,fugitive#CompleteGit Git", "Git") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,fugitive#CompleteGit G", "Git") " Section: :Gcd, :Glcd @@ -2191,7 +2198,7 @@ call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :exe " Section: :Gstatus -call s:command("-bar -bang -range=-1 Gstatus", "Status") +call s:command("-bar -bang -range=-1 -addr=other Gstatus", "Status") function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args, ...) abort let dir = a:0 ? a:1 : s:Dir() @@ -3657,12 +3664,12 @@ function! s:Log(type, bang, line1, count, args) abort return s:QuickfixStream(listnr, title, cmd, !a:bang, s:function('s:LogParse'), state, path, dir) . after endfunction -call s:command("-bang -nargs=? -range=-1 -complete=customlist,s:GrepComplete Ggrep :execute s:Grep(,0,)") +call s:command("-bang -nargs=? -range=-1 -addr=windows -complete=customlist,s:GrepComplete Ggrep :execute s:Grep(,0,)") call s:command("-bang -nargs=? -complete=customlist,s:GrepComplete Gcgrep :execute s:Grep(-1,0,)") call s:command("-bang -nargs=? -complete=customlist,s:GrepComplete Glgrep :execute s:Grep(0,0,)") -call s:command("-bang -nargs=? -range=-1 -complete=customlist,s:LogComplete Glog :exe s:Log('c',0,,,)") -call s:command("-bang -nargs=? -range=-1 -complete=customlist,s:LogComplete Gclog :exe s:Log('c',0,,,)") -call s:command("-bang -nargs=? -range=-1 -complete=customlist,s:LogComplete Gllog :exe s:Log('l',0,,,)") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Glog :exe s:Log('c',0,,,)") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gclog :exe s:Log('c',0,,,)") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gllog :exe s:Log('l',0,,,)") " Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread @@ -3802,7 +3809,7 @@ call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Comp call s:command("-bar -bang -nargs=* -complete=customlist,s:ReadComplete Gpedit execute s:Open('pedit', 0, '', , [])") call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gsplit execute s:Open(( > 0 ? : '').( ? 'split' : 'edit'), 0, '', , [])") call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gvsplit execute s:Open(( > 0 ? : '').( ? 'vsplit' : 'edit!'), 0, '', , [])") -call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete" . (has('patch-7.4.542') ? ' -addr=tabs' : '') . " Gtabedit execute s:Open(( >= 0 ? : '').'tabedit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete -addr=tabs Gtabedit execute s:Open(( >= 0 ? : '').'tabedit', 0, '', , [])") call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gread", "Read") " Section: :Gwrite, :Gwq