When working in Vim I normally split the screen into two vertically. Often both of these viewports are displaying the same file. Is there a way to associate their positions in the file?

Hopefully I make one of them always show the lines immediately following the other, so that as I scroll around in either viewport the other updates.

link|improve this question
feedback

1 Answer

up vote 3 down vote accepted

The feature is called scroll binding. It is controlled by the values of the 'scrollbind' and 'scrollopt' options.

Usage:

  1. Adjust your scrollopt settings.
    Probably you at least want :set scrollopt+=hor.
  2. Position each window (split) so they match up however you like.
  3. :set scrollbind in each window.
  4. Scroll around. Movement in any scroll-bound window will be reflected in all other scroll-bound windows.
link|improve this answer
Perfect! That's exactly what I was looking for. Many thanks. – Amoss Sep 16 '10 at 11:33
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.