Make bang argument to :Glog explicit

Playing with some changes here and committing this part makes it easier
to reload the plugin after stashing changes.
This commit is contained in:
Tim Pope 2018-07-22 21:28:15 -04:00
parent 2fcf95467f
commit d818ac93af

View File

@ -1496,8 +1496,8 @@ endif
call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Ggrep :execute s:Grep('grep',<bang>0,<q-args>)") call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Ggrep :execute s:Grep('grep',<bang>0,<q-args>)")
call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Glgrep :execute s:Grep('lgrep',<bang>0,<q-args>)") call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Glgrep :execute s:Grep('lgrep',<bang>0,<q-args>)")
call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Glog :call s:Log('grep<bang>',<line1>,<count>,<f-args>)") call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Glog :call s:Log('grep',<bang>0,<line1>,<count>,<f-args>)")
call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep<bang>',<line1>,<count>,<f-args>)") call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep',<bang>0,<line1>,<count>,<f-args>)")
function! s:Grep(cmd,bang,arg) abort function! s:Grep(cmd,bang,arg) abort
let grepprg = &grepprg let grepprg = &grepprg
@ -1538,7 +1538,7 @@ function! s:Grep(cmd,bang,arg) abort
endtry endtry
endfunction endfunction
function! s:Log(cmd, line1, line2, ...) abort function! s:Log(cmd, bang, line1, line2, ...) abort
let path = s:Relative('/') let path = s:Relative('/')
if path =~# '^/\.git\%(/\|$\)' || index(a:000,'--') != -1 if path =~# '^/\.git\%(/\|$\)' || index(a:000,'--') != -1
let path = '' let path = ''
@ -1569,7 +1569,7 @@ function! s:Log(cmd, line1, line2, ...) abort
execute cd s:fnameescape(s:repo().tree()) execute cd s:fnameescape(s:repo().tree())
let &grepprg = escape(s:git_command() . join(map(cmd, '" ".s:shellesc(v:val)'), ''), '%#') let &grepprg = escape(s:git_command() . join(map(cmd, '" ".s:shellesc(v:val)'), ''), '%#')
let &grepformat = '%Cdiff %.%#,%C--- %.%#,%C+++ %.%#,%Z@@ -%\d%\+\,%\d%\+ +%l\,%\d%\+ @@,%-G-%.%#,%-G+%.%#,%-G %.%#,%A%f::%m,%-G%.%#' let &grepformat = '%Cdiff %.%#,%C--- %.%#,%C+++ %.%#,%Z@@ -%\d%\+\,%\d%\+ +%l\,%\d%\+ @@,%-G-%.%#,%-G+%.%#,%-G %.%#,%A%f::%m,%-G%.%#'
exe a:cmd exe a:cmd . (a:bang ? '!' : '')
finally finally
let &grepformat = grepformat let &grepformat = grepformat
let &grepprg = grepprg let &grepprg = grepprg