mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 21:33:53 -05:00
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:
@@ -2177,6 +2177,21 @@ function! s:GF(mode) abort
|
||||
elseif getline('.') =~# '^[+-]\{3\} [ab/]'
|
||||
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 '
|
||||
let ref = 'a/'.getline('.')[12:]
|
||||
elseif getline('.') =~# '^rename to '
|
||||
|
||||
Reference in New Issue
Block a user