Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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