Enter on a +/- diff line jumps to that line

This is useful particularly in conjunction with :Gblame.  Press `i` on a
line in a blame to open the commit.  If the diff reveals a new point of
interest, press enter on that line to jump to it in the history, then
:Gblame again.
This commit is contained in:
Tim Pope
2011-10-01 16:48:39 -04:00
parent 8ce49ebea0
commit be42215003

View File

@@ -2177,6 +2177,21 @@ function! s:GF(mode) abort
elseif getline('.') =~# '^[+-]\{3\} [ab/]' elseif getline('.') =~# '^[+-]\{3\} [ab/]'
let ref = getline('.')[4:] let ref = getline('.')[4:]
elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW')
let type = getline('.')[0]
let lnum = line('.') - 1
let offset = -1
while getline(lnum) !~# '^@@ -\d\+,\d\+ +\d\+,'
if getline(lnum) =~# '^[ '.type.']'
let offset += 1
endif
let lnum -= 1
endwhile
let offset += matchstr(getline(lnum), type.'\zs\d\+')
let ref = getline(search('^'.type.'\{3\} [ab]/','bnW'))[4:-1]
let dcmd = '+'.offset.'|foldopen'
let dref = ''
elseif getline('.') =~# '^rename from ' elseif getline('.') =~# '^rename from '
let ref = 'a/'.getline('.')[12:] let ref = 'a/'.getline('.')[12:]
elseif getline('.') =~# '^rename to ' elseif getline('.') =~# '^rename to '