A while ago I saw a vim script which created vertical splits for the current buffer, so that the last line of the left window was the first line of the right window. It sets scrollbind so that what scrolls off the top of the right window, scrolls in at the bottom of the left window.

Now I can't find the script! Does anyone know it?

I set scrollbind myself, but there's niggles which I'm sure the script has smoothed over.

Dyslexic Tangent answers my question, but the page he links to has a link to the script I saw before: Charles Campbell's MultiPage.


Check out this vim script, it does what you want.

Also, thanks for the tip, I hadn't thought of this and it sounds like a great idea.

FYI after playing with the linked tip for a while, this is my result:

noremap <silent> <Leader>vs ggzR:<C-u>let @z=&so<CR>:set so=0 noscb<CR>:set columns=160<CR>:bo vs<CR>zRLjzt:setl scb<CR><C-w>p:setl scb<CR>:let &so=@z<CR>

It does what the tip in the link does, with the addition of moving to line 1, setting the width of the double-wide screen to 160 columns, and opening all folds. Starting anywhere but line 1 was causing me problems and folds were making things inconsistent.

  • It may need some work, actually. The two window's don't seem to line up perfectly as is.
    – mkomitee
    Feb 10 '11 at 13:48
  • Yes the command assumes you're at line 1 in your file, I had to change the command to start with gg in order to get things to match correctly.
    – mkomitee
    Feb 10 '11 at 13:55
  • I was also having some problems with folds and thought it would be best to set the #cols to 160. I added the result to the answer.
    – mkomitee
    Feb 10 '11 at 14:00
  • Cool, excellent starting points :-) Thanks a lot! Yes its essential, makes woking with long docs in Vim 100x more pleasant. Especially these days when wide screens predominate. Feb 12 '11 at 7:42
  • Check out Charles Campbell's stuff .. plenty to blow your mind. Feb 12 '11 at 9:21

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.