In vim, how do you scroll a buffer so the cursor location is centered in the screen?

后端 未结 5 501
半阙折子戏
半阙折子戏 2021-02-02 06:42

In vim, often I will jump to a mark I made, or a search result, and the cursor will be at the very bottom or very top of the screen. At this point, in order for the screen to b

5条回答
  •  误落风尘
    2021-02-02 06:49

    The scrollfix.vim plugin is great for this. That is what I use, and it works like a charm. You can find it on github here.

    The scrollfix plugin allows you to control exactly where (vertically along the buffer) your cursor stays fixed. By default it is at 60% of the buffer from the top, but this is customizable. This affects the position of the cursor in the normal as well as in the insert mode.

提交回复
热议问题