I have two vertically-split buffers in Vim showing two separate files that I want both displayed and scrolled synchronously. With :set scrollbind
at the top of both buffers, I can get the scrolling part down (so when I hit zt
in one buffer, the current line jumps to the top in both buffers), but unfortunately, the display is not synchronized.
What this means is that if the lines in the files are of differing lengths, the two buffers won't be visually aligned. I'd like Vim to display extra line breaks in order to ensure that long wrapped lines do not interfere with the vertically-synchronized display of the two buffers.
Thanks!
In addition to setting scrollbind in both buffers, you need to issue the command :syncbind
. That should sync the scrolling. I don't know if it will do it perfectly if you're wrapping lines and the two files have lines of different lengths. But if you turn wrap off I think it should keep them at same line numbers.
You can use
:set nowrap
To stop the long lines from being wrapped, so that your buffers are synchronised. Not exactly what you asked, but close.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With