From 70ec9278905b5eb0394bfa6411629a22d24230ea Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 19 Mar 2014 23:36:20 -0400 Subject: [PATCH] Improve keepjumps situation --- plugin/fugitive.vim | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index bfd0cde..5b029ff 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -2227,7 +2227,7 @@ function! s:BufReadObject() endif let pos = getpos('.') - silent %delete + silent keepjumps %delete_ setlocal endofline try @@ -2251,22 +2251,23 @@ function! s:BufReadObject() call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) else call s:ReplaceCmd(s:repo().git_command('show','--no-color','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash)) - call search('^parent ') + keepjumps call search('^parent ') if getline('.') ==# 'parent ' - silent delete_ + silent keepjumps delete_ else - silent s/\%(^parent\)\@\)\=$','W',line('.')+3) - silent delete_ + keepjumps let lnum = search('^encoding \%(\)\=$','W',line('.')+3) + if lnum + silent keepjumps delete_ end - 1 + keepjumps 1 endif elseif b:fugitive_type ==# 'blob' call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) endif finally - call setpos('.',pos) + keepjumps call setpos('.',pos) setlocal ro noma nomod noswapfile if &bufhidden ==# '' setlocal bufhidden=delete