Scroll two splits simultaneously

3.4
(218)

If you’ve ever diffed a file in Vim or otherwise had two corresponding splits, you may have wished for a way to scroll them together. Vim can do just that with scrollbind.

With scrollbind enabled, each window in Vim will scroll simultaneously. Line for line as you move through the file, the other window will scroll as well.

Simply run the following:

:set scrollbind

Or to put it back:

:set noscrollbind

You can also toggle the option with:

:set scb!

Here’s a short screencast showing scrollbind in action. This is really invaluable for diffing or just looking at two similar files at once.

How useful was this tip?

Average rating 3.4 / 5. Vote count: 218

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

92 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts

Leave a reply

Your email address will not be published. Required fields are marked *