Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 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.
share|improve this answer
    
Perfect! That's exactly what I was looking for. Many thanks. – Amoss Sep 16 '10 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .