繁体   English   中英

如何拉扯相对线?

[英]How to yank relative line?

我打开了相对的行号。

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

但是如何我说下当前线下面的第5行没有跳到所述线, 5jY5k和跳回(即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

另请参阅此答案以获取更多示例和:help [range]获取Vim文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM