Scrolling relative to cursor

2006-07-19 Thread J.Hofmann
Hi,

Given are two loaded buffers. When I switch beween them by :bn/:bp or
:n#, the window is redrawn similar to z.

z.  Redraw, line [count] at center of window (default
cursor line).  Put cursor at first non-blank in the
line.

Can I change or workaround this behavior not to do this but
to keep the buffer view the same?


Thank You

Joachim
###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/


Re: Scrolling relative to cursor

2006-07-19 Thread Yakov Lerner

On 7/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Given are two loaded buffers. When I switch beween them by :bn/:bp or
:n#, the window is redrawn similar to z. ...
Can I change or workaround this behavior not to do this but
to keep the buffer view the same?


You need vim7 for that.
In vim7, the following works for me:

 when switching buffers, preserve window view
if v:version = 700
au BufLeave * let b:winview = winsaveview()
au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif
endif

Yakov