Thursday, January 10, 2013

Why is buffer view centered after switching to alternate file?

Hello again dear Vimmers!

Recently I have encountered very strange Vim's behaviour during
switching files:

vim -u NONE -N
:h
<C-w>o " to make 'help' window the only one
L " to move cursor to the bottom of the window
<C-6> " or <C-^> to switch to alternate file
<C-6> " go back to 'help' file

Cursor in window with 'help' file is now centered. But I didn't ask
for this! I want cursor to stay where I left it. I dont't want Vim to
make me happy whether I like it or not. What is the rationale behind
this annoying behaviour?

I tried to fix this using following code:

if v:version >= 700
au BufLeave * let b:winview = winsaveview()
au BufEnter * if (exists('b:winview')) | call winrestview(b:winview)
| endif
endif

vim -u NONE -N -S file_with_the_above_code

but it doesn't work for described scenario. So, once again: what is
the rationale behind this behaviour and how can it be fixed ?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: