Home  >  Q&A  >  body text

vim - Can two `split windows` implement `scroll lock` or `scoll sync` or similar functions?

When writing code, because the monitor cannot be raised up, the number of lines displayed in the code is very small, and scrolling up and down is very frequent, so I think like this:

When editing a single file, :vs, there are two vertical windows (The number of the left window is 1-44, and the number of the right window is 45-88) , and then implement the scroll lock or scroll sync function (refer to the tile tabs of firefox), you can make full use of the widescreen space.

Excuse me, has it been implemented?

---Preliminary ideas already available --

:h scroll-bind

过去多啦不再A梦过去多啦不再A梦2683 days ago535

reply all(1)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 16:40:52

    Actually, I don’t quite understand what you mean. From your description, is it to display the same file in vertical split screen, and then bind the two split screens to make them scroll together? If so: :help 'cursorbind' See for yourself.

    However, your initial request is that scrolling is very frequent, so I don’t understand. Even if the scrolling is divided into two screens simultaneously, isn’t it the same as scrolling on one screen? Unless your two screens display two different parts of a file, such as 1-40 on the left and 41-80 on the right, and then scroll simultaneously...~~ However, vim seems to be unable to do this, and you need to write a plug-in. ~~
    Set set scrollbind in both windows. You need to manually adjust the starting lines of the two windows before setting

    reply
    0
  • Cancelreply