在视觉模式下,Vim在相对范围内操作的最佳方式是什么?

drb*_*sen 12 vim range

我经常使用以下内容删除,抽取和粘贴:

:3,6y
Run Code Online (Sandbox Code Playgroud)

从Vim 7开始,我已经切换到使用相对行号.我发现通过命令h,j,k,l等使用相对行编号要容易得多.

由于切换到相对行编号,我发现很难在绝对范围内操作(例如:3,6y).由于Vim正在显示相对行号,因此确定需要选择的绝对行号需要花费太长时间.

如果您的设置显示相对行号,那么在某个范围内使用视觉选择的最佳/最快方法是什么?天真地,我正在寻找类似的东西:

:-2,+8y 

(yank the lines from 2 lines above my current position to 
8 lines below my current position.)
Run Code Online (Sandbox Code Playgroud)

Ben*_*oit 15

你尝试过天真的事吗?

:-2,+8y相当于:.-2,.+8y并且应该做你想做的事.

请注意,如果您未指定数字,1则假定为::,+y表示.,.+1 y:猛拉当前行和下一行.

:help range它没有很好的解释.相关部分如下:

Line numbers may be specified with:     *:range* *E14* *{address}*
    [...]
    .       the current line              *:.*
    [...]
Each may be followed (several times) by '+' or '-' and an optional number.
This number is added or subtracted from the preceding line number.  If the
number is omitted, 1 is used.
Run Code Online (Sandbox Code Playgroud)

文档没有说明的是,如果+r -之前没有任何东西,.则假设.