Mercurial > vim-lawrencium
changeset 148:fb65725f2872
Use winsaveview() and winrestview() to save a few lines of code.
author | Shane Harper <shane@shaneharper.net> |
---|---|
date | Sat, 11 Jan 2020 14:29:47 +1100 |
parents | 06f4d2c01fd6 |
children | 5e72afea669c |
files | autoload/lawrencium/annotate.vim |
diffstat | 1 files changed, 3 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/autoload/lawrencium/annotate.vim Tue Apr 09 20:19:02 2019 -0700 +++ b/autoload/lawrencium/annotate.vim Sat Jan 11 14:29:47 2020 +1100 @@ -43,9 +43,8 @@ setlocal nowrap nofoldenable setlocal filetype=hgannotate else - " Store some info about the current buffer. - let l:cur_topline = line('w0') + &scrolloff - let l:cur_line = line('.') + " Store some info about the current window. + let l:view = winsaveview() let l:cur_wrap = &wrap let l:cur_foldenable = &foldenable @@ -70,11 +69,7 @@ call l:annotate_buffer.OnDelete('setlocal foldenable') endif - " Go to the line we were at in the source buffer when we - " opened the annotation window. - execute l:cur_topline - normal! zt - execute l:cur_line + call winrestview({'lnum': l:view.lnum, 'topline': l:view.topline}) syncbind " Set the correct window width for the annotations.