2

I have been searching for a way to do the following but haven't found exactly what I need, not sure if it's possible. I want to be able to split a file, but have the same features over the two splits as if I was in a single pane. Let me give an example:

  • I have a 200 line file, and 80 line column length in my terminal.
  • when I split, lines 0-79 should appear in the first pane, and lines 80-159 in the second (possible with mpage.vim, as I have tried).
  • If I do a page down, the first pane should show lines 160-199, and the second pane should be empty.
  • if I'm at the end of the first pane and hit j, it should jump to the first line of the next pane.

So basically what I'm looking for is to have a seamless split, but have everything operate as if I was in a single pane.

1 Answer 1

1

I have something similar to what you want:

" Two columns.
" 1. Vertically split window
" 2. Offset it one screen
" 3. Scrollbind
command! TwoColumns
            \   exe "normal! zR"
            \ | set noscrollbind
            \ | vsplit
            \ | set scrollbind
            \ | wincmd w
            \ | exe "normal! \<c-f>2\<C-e>"
            \ | set scrollbind
            \ | wincmd p

enter image description here

Not sure if you also want to change active window when you reach the last line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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