简体   繁体   English

vim:在当前行上方与当前行一起划线

[英]vim: yank lines above the current line together with the current line

I find myself doing Nyy very often to yank the current line and N-1 lines below. 我发现自己经常做NyyNyy当前线和下面的N-1线。 So 3yy would yank the current line and 2 more lines (so all together 3). 因此, 3yy3yy当前行和另外2行(所以总共3行)。

I know how to yank N lines above the current line ( yNk ), but this does not include the current line. 我知道如何在当前行( yNk )上方yNk N行,但这不包括当前行。 What I want is to yank the current line and N-1 lines above. 我想要的是猛拉当前线和上面的N-1线。 How do I do this (ideally also with the yy command)? 我该怎么做(理想情况下还使用yy命令)?

Edit: Apparently yNk includes the current line as well. 编辑:显然yNk包括当前行。 I must have missed it. 我一定错过了。 Thx for the comments. 感谢你的评论。

The following will yank the current line plus two above: 以下内容将使当前行加上以上两行:

2yk

Obviously changing the 2 will alter the number of lines yanked above. 显然,改变2会改变上面猛拉的线数。 No number is an implicit 1 , so yk is equivalent to 1yk . 没有数字是隐含1 ,因此yk相当于1yk

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

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