Improve keepjumps situation

This commit is contained in:
Tim Pope 2014-03-19 23:36:20 -04:00
parent b27937d5e4
commit 70ec927890

View File

@ -2227,7 +2227,7 @@ function! s:BufReadObject()
endif endif
let pos = getpos('.') let pos = getpos('.')
silent %delete silent keepjumps %delete_
setlocal endofline setlocal endofline
try try
@ -2251,22 +2251,23 @@ function! s:BufReadObject()
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
else 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 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 ' if getline('.') ==# 'parent '
silent delete_ silent keepjumps delete_
else else
silent s/\%(^parent\)\@<! /\rparent /ge silent keepjumps s/\%(^parent\)\@<! /\rparent /ge
endif endif
if search('^encoding \%(<unknown>\)\=$','W',line('.')+3) keepjumps let lnum = search('^encoding \%(<unknown>\)\=$','W',line('.')+3)
silent delete_ if lnum
silent keepjumps delete_
end end
1 keepjumps 1
endif endif
elseif b:fugitive_type ==# 'blob' elseif b:fugitive_type ==# 'blob'
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
endif endif
finally finally
call setpos('.',pos) keepjumps call setpos('.',pos)
setlocal ro noma nomod noswapfile setlocal ro noma nomod noswapfile
if &bufhidden ==# '' if &bufhidden ==# ''
setlocal bufhidden=delete setlocal bufhidden=delete