简体   繁体   English

Vim粘贴行为

[英]Vim paste behaviour

I am a bit of a beginner when it comes to Vim and it is currently irritating me in many ways. 在谈到Vim时,我还是个初学者,目前在很多方面都激怒了我。 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: 如果使用P粘贴到狗的d处,我将使用可视模式选择数字字(4行),我得到以下信息:

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. 我注意到,如果我执行y4y而不是目视选择线条,它的行为将达到我的预期。 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? 以及如何使我在视觉上选择的块可以粘贴?

Seems that you are entering into the Visual Block selection mode ( Ctrl - V ). 似乎您正在进入可视块选择模式( Ctrl - V )。

To get your desired output, enter into a Linewise Selection mode, just by pressing V . 要获得所需的输出,只需按V即可进入逐行选择模式。

使用Shift+V ,逐行选择

try 尝试

:set paste

before pasting. 粘贴之前。

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

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