Jump to file not diff for boundary commit in :Gblame
This commit is contained in:
parent
11691b38bb
commit
c21736dde7
@ -4596,7 +4596,7 @@ function! s:BlameCommitFileLnum(...) abort
|
||||
if commit =~# '^0\+$'
|
||||
let commit = ''
|
||||
elseif line !~# '^\^' && has_key(state, 'blame_reverse_end')
|
||||
let commit = get(s:LinesError('rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, commit)
|
||||
let commit = get(s:LinesError('rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, '')
|
||||
endif
|
||||
let lnum = +matchstr(line, ' \zs\d\+\ze \%((\| *\d\+)\)')
|
||||
let path = matchstr(line, '^\^\=\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s\+\%(\%( \d\+ \)\@<!([^()]*\w \d\+)\|\d\+ \)')
|
||||
@ -4833,12 +4833,23 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort
|
||||
endfunction
|
||||
|
||||
function! s:BlameCommit(cmd, ...) abort
|
||||
let [commit, path, lnum] = call('s:BlameCommitFileLnum', a:000)
|
||||
let line = a:0 ? a:1 : getline('.')
|
||||
let state = a:0 ? a:2 : s:TempState()
|
||||
let sigil = has_key(state, 'blame_reverse_end') ? '-' : '+'
|
||||
let mods = (s:BlameBufnr() < 0 ? '' : &splitbelow ? "botright " : "topleft ")
|
||||
let [commit, path, lnum] = s:BlameCommitFileLnum(line, state)
|
||||
if empty(commit) && len(path) && has_key(state, 'blame_reverse_end')
|
||||
let path = (len(state.blame_reverse_end) ? state.blame_reverse_end . ':' : ':(top)') . path
|
||||
return s:Open(mods . a:cmd, 0, '', '+' . lnum . ' ' . s:fnameescape(path), ['+' . lnum, path])
|
||||
endif
|
||||
if commit =~# '^0*$'
|
||||
return 'echoerr ' . string('fugitive: no commit')
|
||||
endif
|
||||
let sigil = has_key(a:0 ? a:2 : s:TempState(), 'blame_reverse_end') ? '-' : '+'
|
||||
let cmd = s:Open((s:BlameBufnr() < 0 ? '' : &splitbelow ? "botright " : "topleft ") . a:cmd, 0, '', commit, [commit])
|
||||
if line =~# '^\^' && !has_key(state, 'blame_reverse_end')
|
||||
let path = commit . ':' . path
|
||||
return s:Open(mods . a:cmd, 0, '', '+' . lnum . ' ' . s:fnameescape(path), ['+' . lnum, path])
|
||||
endif
|
||||
let cmd = s:Open(mods . a:cmd, 0, '', commit, [commit])
|
||||
if cmd =~# '^echoerr'
|
||||
return cmd
|
||||
endif
|
||||
|
@ -199,11 +199,13 @@ that are part of Git repositories).
|
||||
A resize to end of author column
|
||||
C resize to end of commit column
|
||||
D resize to end of date/time column
|
||||
gq close blame, then |:Gedit| to return to work tree version
|
||||
<CR> close blame, then open commit
|
||||
o open commit in horizontal split
|
||||
O open commit in new tab
|
||||
p open commit in preview window
|
||||
gq close blame, then |:Gedit| to return to work
|
||||
tree version
|
||||
<CR> close blame, and jump to patch that added line
|
||||
(or directly to blob for boundary commit)
|
||||
o jump to patch or blob in horizontal split
|
||||
O jump to patch or blob in new tab
|
||||
p jump to patch or blob in preview window
|
||||
- reblame at commit
|
||||
~ reblame at [count]th first grandparent
|
||||
P reblame at [count]th parent (like HEAD^[count])
|
||||
|
Loading…
Reference in New Issue
Block a user