在内联粘贴后,我的窗口显示文档的右侧部分(列>80)。
在保持光标在当前位置的情况下,如何使屏幕水平居中于它周围。或者我可以将屏幕向左移动半个屏幕宽度,避免使用固定数字,例如44zh?
尽管标题不具体,但所有答案都只涉及上下移动: 如何在Vim中移动屏幕而不移动光标?
在保持光标在当前位置的情况下,如何使屏幕水平居中于它周围。或者我可以将屏幕向左移动半个屏幕宽度,避免使用固定数字,例如44zh?
尽管标题不具体,但所有答案都只涉及上下移动: 如何在Vim中移动屏幕而不移动光标?
我不确定如何在光标周围水平居中屏幕,但是如果要向左/右移动半个屏幕,请尝试以下方法(来自 :help scroll-horizontal
)
我不知道如何将屏幕水平居中在光标周围,但是如果要将屏幕向左/向右移动半个屏幕,请尝试以下方法(取自:help scroll-horizontal
)
zL Move the view on the text half a screenwidth to the
right, thus scroll the text half a screenwidth to the
left. This only works when 'wrap' is off. {not in
Vi}
zH Move the view on the text half a screenwidth to the
left, thus scroll the text half a screenwidth to the
right. This only works when 'wrap' is off. {not in
Vi}
我正在使用的一个不错的配置选项是sidescrolloff
,它是scrolloff
的相反。
我目前在我的.vimrc中同时使用这两个选项,这是我无法离开的设置。当然,你可以根据需要增加/减少偏移量。这有点取决于你工作的文档类型 :)
set scrolloff=20 " keep 20 lines visible above and below cursor at all times
set sidescrolloff=30 " keep 30 columns visible left and right of the cursor at all times
以下是Vim的一些信息 :help
scrolloff:保持光标上下至少几行可见,以显示你正在编辑的上下文。
sidescrolloff:如果设置了'nowrap',则保持光标左右至少几列可见。
zl
和 zh
用于移动一个字符