Duplicate of the auto-closed #2477.
When I switch from buffer A to buffer B and then back again, the cursor line in A is scrolled to the center of the window. This is confusing. I would like the window to display the buffer exactly as it was displayed before. I think this is the expected behavior.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
When I follow a hotlink in the help to a different helpfile, and then use Ctrl-O to come back, the cursor line (if not near the top or bottom of the file) is now centered. AFAICR it's always been like that. But if you set 'scrolloff' to a large value, Vim will always keep the cursor centered (scrolling the file as needed) and going to another buffer and back will bring you just as centered as you already were.
Best regards,
Tony.
Hi Tonymec.
Once one jumps to another position in the same buffer, he knows the buffer will scroll, that's quite inevitable, so there is not much expectation to have the very same position when coming back (though it would be admitedly cool). But when switching buffers, it is actually surprising behavior. Note how other editors and web browsers won't scroll if you change tabs.
Thanks Gary, I follow you there. I have recently switched from the tab-centered to the buffer-centered approach to Vim and went through those clarifications, sorry if I still slip on some details.
If one understands Vim fundamentals, it is indeed a bit naive to assume the behavior I'm requesting when switching buffers. But I don't think there is much dispute on that leaving the viewport in place (or, rather, restoring it to the original offset) is the expected thing to happen when returning to a buffer, as one has to reorient himself otherwise.
In my opinion, this is another potential reason why novice users may fall to the one file = one tab trap. They observe the behavior they expect on tabs, so they stick to them. I think this proposal would be a nice addition, but I don't want to be pressing here, I'm just trying to make my point clear.
—
You are receiving this because you commented.
Duplicate of the auto-closed #2477.
When I switch from buffer A to buffer B and then back again, the cursor line in A is scrolled to the center of the window. This is confusing. I would like the window to display the buffer exactly as it was displayed before. I think this is the expected behavior.
This view reposition is annoying to me too. In the meantime you may try https://vim.fandom.com/wiki/Avoid_scrolling_when_switch_buffers
—
You are receiving this because you commented.
It would be great to get a builtin option added to fix this behavior. The https://vim.fandom.com/wiki/Avoid_scrolling_when_switch_buffers workaround seems to work for me after a few quick tests, though the comments note some possible issues with that approach. Regardless, it would be great to get a similar solution added to vim as a builtin option.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()