Scrolling down both parts of a split-window at the same time in Vim

:windo set scrollbind

will set scrollbind in all windows.


Go to the first split, and type in

:set scrollbind

Go to the next one (ctrl+w), and do the same.

To disable:

:set noscrollbind

For more info, check the documentation for scroll binding - http://vimdoc.sourceforge.net/htmldoc/scroll.html#scroll-binding


From the command line:

vim -O file1 file2 -c 'windo set scb!'

-O = open side by side.

-c = what follows in quotes is treated as a vim option.

'windo' = apply to all panels.

'scb' = shorthand for scrollbind. Saves some typing, but the two are interchangeable.

'!' = toggle. This way you can use the same command to turn it off later if you choose to.


See the documentation for scroll-binding. You'll need to set this for each window that you want bound (e.g. a minimum of 2)

If you're comparing 2 files, however, vimdiff may be of more use

Tags:

Vim