Make file_at_revision() preserve cursor position
note that this may still change the cursor position due to deletions and insertions further up in the file, but now the cursor should at least end up somewhere near its original position for smaller commits.
This commit is contained in:
parent
04eb8d6828
commit
2735e3ab59
1 changed files with 4 additions and 0 deletions
4
vimrc
4
vimrc
|
@ -400,6 +400,7 @@ function! s:git_prev()
|
|||
endfun
|
||||
|
||||
function! s:file_at_revision(rev)
|
||||
let l:pos = getpos(".")
|
||||
if exists("b:git_original_file") " Is this already a file@revision buffer?
|
||||
let l:fname = b:git_original_file
|
||||
let l:ftail = fnamemodify(b:git_original_file, ":t")
|
||||
|
@ -418,6 +419,9 @@ function! s:file_at_revision(rev)
|
|||
|
||||
let b:git_original_file = l:fname
|
||||
let b:git_revision_hash = a:rev
|
||||
let l:pos[0] = bufnr('.')
|
||||
call setpos('.', l:pos)
|
||||
redraw
|
||||
call s:git_info()
|
||||
endfun
|
||||
|
||||
|
|
Loading…
Reference in a new issue