From acf3cb44003eb758d73034c3a86b23af32652dfb Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 3 Jan 2019 16:33:44 -0500 Subject: [PATCH] Reveal full hunk on :Gstatus CTRL-N --- autoload/fugitive.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 85ff078..11f46a2 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2057,10 +2057,24 @@ function! s:StageInfo(...) abort \ 'index': index} endfunction +function! s:StageReveal(...) abort + let begin = a:0 ? a:1 : line('.') + if getline(begin) =~# '^@' + let end = line(begin) + 1 + while getline(end) =~# '^[ \+-]' + let end += 1 + endwhile + while end > line('w$') && line('.') > line('w0') + &scrolloff + execute "normal! \" + endwhile + endif +endfunction + function! s:StageNext(count) abort for i in range(a:count) call search('^[A-Z?] .\|^[0-9a-f]\{4,\} \|^@','W') endfor + call s:StageReveal() return '.' endfunction @@ -2071,6 +2085,7 @@ function! s:StagePrevious(count) abort for i in range(a:count) call search('^[A-Z?] .\|^[0-9a-f]\{4,\} \|^@','Wbe') endfor + call s:StageReveal() return '.' endif endfunction