2

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.

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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