By default, vim will purposefully try to vertically center the line that the
cursor was on most recently when coming back to a buffer (e.g. with Ctrl-^ or
:edit if the buffer is already loaded).
I find this disorienting. I would rather have my window and cursor position stay
exactly how I left it. The script here does exactly that:
http://vim.wikia.com/wiki/Avoid_scrolling_when_switch_buffers
That script seems to work almost always. However, there is one odd case where it
does not work because of perhaps a small bug in Vim:
Scenario Where the Above Script Does Not Restore Window
=======================================================
I start with a buffer (with a lot of lines relative to the height of the window)
scrolled all the way to the top (line 1 at the top of the window). I then move
my cursor to anywhere in the bottom half of the window (.e.g with L). Line 1 of
the buffer should still be visible at the top of the window.
When I switch to another buffer (e.g. with Ctrl-^) and then back again, the
window is not restored as expected. Instead, the line that I was on is in the
center.
----------------------------------------------------------------
:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 10 2017 18:06:39)
macOS version
Included patches: 1-1250
Compiled by Homebrew
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tuesday, November 21, 2017
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment