Vim 粘贴行为
对于 Vim,我还是个初学者,目前它在很多方面都让我感到恼火。其中之一如下:
假设我在文件中有以下文本
one
two
three
four
dog
frog
log
mog
,并且我已使用视觉模式选择数字单词(4行),如果我然后使用 P 粘贴到狗中的“d”处,我会得到以下结果:
one
two
three
four
one dog
two frog
threelog
four mog
我想要的输出是:
one
two
three
four
one
two
three
four
dog
frog
log
mog
我注意到,如果我执行 y4y 而不是直观地选择行,它的行为就会如我所料。那么是什么导致了我所看到的行为差异呢?我怎样才能让我的视觉选择的块按照我的意愿粘贴?
I am a bit of a beginner when it comes to Vim and it is currently irritating me in many ways. One of which is the following:
Say i have the following text in a file
one
two
three
four
dog
frog
log
mog
and I have used visual mode to select the number words (4 lines) if I then use P to paste at the 'd' in dog i get the following:
one
two
three
four
one dog
two frog
threelog
four mog
My desired output would be:
one
two
three
four
one
two
three
four
dog
frog
log
mog
I've noticed that it behaves as I expect if i do a y4y instead of visually selecting the lines. So what is causing the difference in behavior that I am seeing? and how can I get my visually selected block to paste as I would like?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
似乎您正在进入视觉 块选择 模式 (Ctrl-V)。
要获得所需的输出,请输入逐行选择 模式,只需按 V。
Seems that you are entering into the Visual Block selection mode (Ctrl-V).
To get your desired output, enter into a Linewise Selection mode, just by pressing V.
使用
Shift+V
,逐行选择Use
Shift+V
, it selects line by line尝试一下。
粘贴前先
try
before pasting.