假设我在vim中打开了一个有许多文本/代码行的文件。
我用:150
跳到第150行,然后我的光标在屏幕底部,我可能想知道接下来几行是什么样子。
我想知道是否有一种设置可以让vim的光标永远不要到达屏幕的最后4〜6行,而应该向上滚动文本。
这样的设置是否可行?
假设我在vim中打开了一个有许多文本/代码行的文件。
我用:150
跳到第150行,然后我的光标在屏幕底部,我可能想知道接下来几行是什么样子。
我想知道是否有一种设置可以让vim的光标永远不要到达屏幕的最后4〜6行,而应该向上滚动文本。
这样的设置是否可行?
使用
set scrolloff=6
以下是来自vim帮助文档的内容,用于设置6行的滚动偏移量:
'scrolloff' 'so' number (default 0)
global
{not in Vi}
Minimal number of screen lines to keep above and below the cursor.
This will make some context visible around where you are working. If
you set it to a very large value (999) the cursor line will always be
in the middle of the window (except at the start or end of the file or
when long lines wrap).
For scrolling horizontally see 'sidescrolloff'.
NOTE: This option is set to 0 when 'compatible' is set.