Vim yank line然后粘贴它

我有以下几行:
thing();
getStuff();

我想使用yy取得getStuff(),前进到thing(),放置光标(并命中p,但因为我yank整个行,p将粘贴getstuff()回到它的位置。

我知道你可以^ D得到的行getStuff()然后p会做我想要的。但是,我觉得这比yy更冗长乏味。

有什么办法yy但粘贴行内联吗?

使用yiw(“yank内部字”)而不是yy只是你想要的:

yy是线性的,并且将抓取包括回车的整行,如果你查看未命名的寄存器(“”),你可以看到:寄存器用作粘贴的源。请参阅:help“”:

Vim uses the contents of the unnamed register for any put command (p or P)
which does not specify a register. Additionally you can access it with the
name ‘”‘. This means you have to type two double quotes. Writing to the “”
register writes to register “0.

yiw的另一个好处是,你不必在“词”的前面,你是打屁股!

相关文章

解决方案:解决linux下vim乱码的情况:(修改vimrc的内容)全...
Linuxvi/vim所有的UnixLike系统都会内建vi文书编辑器,其他的...
      vim正则匹配:空行:/^$/  /^[\t]*$/注释...
$select-editorSelectaneditor.Tochangelater,run'sele...
上次手贱忘了保存,这次就简单做个备忘吧,把踩过的坑记一下...
Linux之文本编译器小结vim的优势所有的UNIX-LIKE习通都会内置...