Vim复制一个块并将其粘贴到多行 [英] Vim copy a block and paste it to multiple lines
本文介绍了Vim复制一个块并将其粘贴到多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我可以在第1行上进行yy
,然后可视地选择第4行和第5行2p
(
I know I can yy
on line 1 and then visual select lines 4 and 5 2p
(Vim copy one line and paste it to multiple lines).
1 COPY THIS
2
3
4 HERE
5 HERE
所以我得到了
1 COPY THIS
2
3
4 COPY THIS
5 COPY THIS
但是,让我们说我只想复制.如果我在视觉效果块中选择COPY,然后在视觉效果的第4行和第5行中选择2p
But instead, let's say I would like just COPY. If I visual block select COPY and then 2p
on lines 4 and 5 visual selected
1 COPY THIS
2
3
4 COPYCOPY
5
如何在每行粘贴1x?喜欢:
How do I paste 1x at each line? Like:
1 COPY THIS
2
3
4 COPY
5 COPY
推荐答案
您可以修改寄存器"
(未命名)以包含换行符,但是此时很可能更容易创建新行,并粘贴内容并再次dd
.
You can modify the register "
(unnamed) to contain a newline, but at this point its most likely easier to create a new line, paste your content in it and dd
it again.
v
l (or other moving chars to mark the area you want)
y
:let @" = @" . "\n"
2p
有关进一步的想法,另请参见此线程
For further ideas see also this thread.
这篇关于Vim复制一个块并将其粘贴到多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文