When I open a vertical split in vim, it takes my current line and bumps it to the top of the buffer (scrolling the entire file up). How do I get vim to retain its current position?
TLDR: This behavior only happens on the first time a new window is created. If you close the window and do it again, the cursor in the new buffer is the same as in the old buffer. The answer on there was to do something useless that opens then closes a window, and then to do your vertical split.
So when you press
Hope this is better - works perfectly for me. Thanks for making me want to figure out something usable to work around this annoying behavior!
This happens all the time to me! I recently came up with an answer that works most of the time (better than nothing though). Put this in your
Everytime you press
The behavior in
Again, it works most of the time for me, not sure why it doesn't work all the time. Anyways, hope this helped some
This might be happening because you have long lines that are getting bunched up by the vertical split. If you