VIM:远离搜索边缘
我最近看到一些 VIM 配置,其中搜索匹配项会滚动到匹配项后面的 N 行,这样搜索匹配项下面会有 N 行,而不是在最后一行(以提供上下文)。我找不到提到这一点的页面,显然我不知道谷歌搜索的正确关键字!
这个功能叫什么?假设我不知道它叫什么,我如何使用 VIM 手册找到它?
谢谢。
I recently saw some VIM configuration where search matches would scroll to N lines past the match, so that there would be N lines below the search match instead of it being on the last line (to give context). I cannot find the page where this was mentioned, and apparently I do not know the right keywords to google for!
What is this feature called, and how could I have used the VIM manual to find it assuming that I don't know what it is called?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,这不能仅用于搜索,而是一个可用于所有情况的设置。
您正在寻找
scrolloff
:保持光标上方和下方的最小屏幕行数。这将使您工作地点周围的一些背景变得可见。 sidescrolloff 做同样的事情,但是是水平的。这是我的
.vimrc
中的内容:As far as I tell this can't be set just for search, but is a setting that will be used in all situations.
You are looking for
scrolloff
: Minimal number of screen lines to keep above and below the cursor. This will make some context visible around where you are working.sidescrolloff
does the same thing but horizontally.This is what I have in my
.vimrc
: