在 vim 中,如何滚动缓冲区以使光标位置在屏幕中央? [英] In vim, how do you scroll a buffer so the cursor location is centered in the screen?

查看:52
本文介绍了在 vim 中,如何滚动缓冲区以使光标位置在屏幕中央?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vim中,我经常会跳转到我做的一个标记,或者一个搜索结果,光标会在屏幕的最底部或最顶部.此时,为了让屏幕更容易阅读,我想滚动缓冲区,使光标下的文本位于屏幕中间.

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 be easier to read, I want to scroll the buffer so that the text under the cursor is in the middle of the screen.

这在vim中可行吗?你是怎么做到的?

Is this possible in vim? How do you do it?

推荐答案

这将使当前行居中

zz

或者,您可以将 scrolloff 设置为较大的类似 999 并且工作行将始终位于中心,除非您靠近文件的开头或结尾.

Optionally you could set scrolloff to something large like 999 and the working line will always be in the center, except when you are towards the start or end of the file.

:set scrolloff=999

这篇关于在 vim 中,如何滚动缓冲区以使光标位置在屏幕中央?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆