Vim 如何拉扯相对线?

Vim 如何拉扯相对线?,vim,Vim,我打开了相对行号 我可以使用:10y猛拉第10行 但是,我如何在不跳到当前线下的第5行的情况下猛拉并向后跳(即5jY5k) 如果我有这个文件: 2 describe 'foobar' do 1 it 'should be cool' do 46 # do stuff 1 end 2 end 我在第46行,我想拔掉相对的第1行或第2行,在上面或下面。您可以使用+n和-n作为相对地址: :+2y " Two lines after the current li

我打开了相对行号

我可以使用
:10y
猛拉第10行

但是,我如何在不跳到当前线下的第5行的情况下猛拉并向后跳(即
5jY5k

如果我有这个文件:

2   describe 'foobar' do
1     it 'should be cool' do
46      # do stuff
1     end
2  end

我在第46行,我想拔掉相对的第1行或第2行,在上面或下面。

您可以使用
+n
-n
作为相对地址:

:+2y    " Two lines after the current line
:-2y    " Two lines before the current line
您还可以将以下内容结合起来:

:-2,+2y   "  Two lines before the cursor and two lines after
有关更多示例和Vim文档,请参阅