Stefano Borini
Stefano Borini

Reputation: 143895

auto-scrollable pagination with vim using vertical split

I want to achieve the following: I want to split a vim session into two (or more) vertical windows (with the :vsplit command). Then, I want to have each window contents vertically offsetted so that the line after the last visible one of the first window becomes the first line of the second window. Then, when I use the arrows to scroll around, the vertical windows are scrollbound so that text flows from the second window into the first. How can I achieve this?

Upvotes: 7

Views: 925

Answers (2)

sidyll
sidyll

Reputation: 59297

First, split your window normally and position it according to your needs (last line in one, first line in the other).

Now, run :set scrollbind in the first window. Jump to the second one and do the same, you can also use :set scb for short.

That's it!

And be sure to read :h scroll-binding.

Upvotes: 0

mike3996
mike3996

Reputation: 17537

There are plugins for that: MultiPage

You can also use a oneliner described in this post by Chip Campbell:

 :nmap <silent> <Leader>ef :vsplit<bar>wincmd l<bar>exe "norm! Ljz<c-v><cr>"<cr>:set scb<cr>:wincmd h<cr> :set scb<cr>

This will bind <Leader>ef to open a vsplit and make the splits continuous.

Upvotes: 9

Related Questions