How to paste before the cursor after selecting a vertical block?

爱⌒轻易说出口 提交于 2020-01-11 20:57:06

问题


I'm so sure that this must exist, but if it doesn't maybe there is a macro for it...

One of my most favourite features of vim is the insert before when in visual mode (<C-v>, select the lines, <C-I>, type a little, then Esc).

My issue is that I want to paste the clipboard contents before, not 'insert'. I tried <C-P> but no love.

I have read cheat sheets, searched everywhere, looked through the questions on here and haven't found it, but I could definitely be searching for the wrong thing.


回答1:


I assume you mean using I in visual block mode to insert the same text on multiple lines, where hitting p simply pastes on the current line rather than all the selected lines.

In insert mode, you can hit C-r followed by a register to insert the contents of that register, so if you wanted to paste the unnamed buffer, you'd enter

C-r"

Similarly, to paste from the clipboard

C-r* 

By entering insert as you normally would, then using C-r, you'll get the text on all of the selected lines.

Take a look at :h registers to see what registers are available to you.




回答2:


Generally, the P command (upper case, different from p) pastes the contents of the clipboard before the cursor position. Is that what you're looking for? (I'm not quite sure what you mean when you say you press Command+I, as my keyboard doesn't have a Command key.)



来源:https://stackoverflow.com/questions/4073731/how-to-paste-before-the-cursor-after-selecting-a-vertical-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!