parent
4581cd4217
commit
276f89837f
@ -84,6 +84,11 @@ that are part of Git repositories).
|
||||
previous commits rather than previous file revisions
|
||||
are loaded.
|
||||
|
||||
:{range}Glog [args] Use git-log -L to load previous revisions of the given
|
||||
range of the current file into the quickfix list. The
|
||||
cursor is positioned on the first line of the first
|
||||
diff hunk for each commit.
|
||||
|
||||
*fugitive-:Gllog*
|
||||
:Gllog [args] Like |:Glog|, but use the location list instead of the
|
||||
quickfix list.
|
||||
|
@ -1065,8 +1065,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 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>',<count>,<f-args>)")
|
||||
call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep<bang>',<count>,<f-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=* -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep<bang>',<line1>,<count>,<f-args>)")
|
||||
|
||||
function! s:Grep(cmd,bang,arg) abort
|
||||
let grepprg = &grepprg
|
||||
@ -1107,13 +1107,13 @@ function! s:Grep(cmd,bang,arg) abort
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:Log(cmd, count, ...) abort
|
||||
function! s:Log(cmd, line1, line2, ...) abort
|
||||
let path = s:buffer().path('/')
|
||||
if path =~# '^/\.git\%(/\|$\)' || index(a:000,'--') != -1
|
||||
let path = ''
|
||||
endif
|
||||
let cmd = ['--no-pager', 'log', '--no-color']
|
||||
let cmd += ['--pretty=format:fugitive://'.s:repo().dir().'//%H'.path.':'.(a:count ? a:count : '').'::'.g:fugitive_summary_format]
|
||||
let cmd += ['--pretty=format:fugitive://'.s:repo().dir().'//%H'.path.'::'.g:fugitive_summary_format]
|
||||
if empty(filter(a:000[0 : index(a:000,'--')],'v:val !~# "^-"'))
|
||||
if s:buffer().commit() =~# '\x\{40\}'
|
||||
let cmd += [s:buffer().commit()]
|
||||
@ -1123,7 +1123,11 @@ function! s:Log(cmd, count, ...) abort
|
||||
end
|
||||
let cmd += map(copy(a:000),'s:sub(v:val,"^\\%(%(:\\w)*)","\\=fnamemodify(s:buffer().path(),submatch(1))")')
|
||||
if path =~# '/.'
|
||||
let cmd += ['--',path[1:-1]]
|
||||
if a:line2
|
||||
let cmd += ['-L', a:line1 . ',' . a:line2 . ':' . path[1:-1]]
|
||||
else
|
||||
let cmd += ['--', path[1:-1]]
|
||||
endif
|
||||
endif
|
||||
let grepformat = &grepformat
|
||||
let grepprg = &grepprg
|
||||
@ -1132,7 +1136,7 @@ function! s:Log(cmd, count, ...) abort
|
||||
try
|
||||
execute cd.'`=s:repo().tree()`'
|
||||
let &grepprg = escape(call(s:repo().git_command,cmd,s:repo()),'%#')
|
||||
let &grepformat = '%f:%l::%m,%A%f:::%m,%Cdiff --git %.%#,%C--- %.%#,%C+++ %.%#,%Z@@ -%\d%\+\,%\d%\+ +%l\,%\d%\+ @@,%-G%.%#'
|
||||
let &grepformat = '%Cdiff %.%#,%C--- %.%#,%C+++ %.%#,%Z@@ -%\d%\+\,%\d%\+ +%l\,%\d%\+ @@,%-G-%.%#,%-G+%.%#,%-G %.%#,%A%f::%m,%-G%.%#'
|
||||
exe a:cmd
|
||||
finally
|
||||
let &grepformat = grepformat
|
||||
|
Loading…
Reference in New Issue
Block a user