Reputation: 6937
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!
Upvotes: 44
Views: 12028
Reputation: 79225
I doubt Vim is really appropriate to diff vertically buffers that have very long lines of text if you need to wrap them, and yet, I am a real Vim aficionado.
What I could suggest to you is:
:g/^/put _
). If you are translating, line numbers should not really be subject to changes?Upvotes: 0
Reputation: 22256
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.
Upvotes: 22
Reputation: 18359
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.
Upvotes: 3