commit be42215003c4955eae8f72fa14af7a371b6088e3 (tree)
parent 8ce49ebea0a11c5c91d8ff38f10b9d5cfcf01a3f
Author: Tim Pope <code@tpope.net>
Date: Sat, 1 Oct 2011 16:48:39 -0400
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.
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -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 '