Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim block paste inline or new line

Tags:

vim

I have this problem where I try to yank/cut and paste a block of text with Vim and it has inconsistent behavior.

What happens is this:

In this text bellow, I what to cut the middle column and paste after the third. So I block-select (ctrl-v) the text, cut it (x), take the cursor to the end of the third column (now 2nd) and paste (p)

A 1 a
B 2 b 
C 3 c
D 4 d

Sometimes Vim does it right and the result is this:

A a 1
B b 2
C c 3
D d 4

and some times, the result is this:

A a
1
2
3
4
B b
C c
D d

I need to control that behavior instead of being a hostage of it... How do I control this behavior?

like image 314
MtCS Avatar asked Oct 21 '25 05:10

MtCS


1 Answers

Well, one answer is the UnconditionalPaste plugin (https://vimawesome.com/plugin/unconditionalpaste)

with a 'gbp' you paste a block inline (I remapped to [LEADER]pb)

it works...

like image 102
MtCS Avatar answered Oct 24 '25 21:10

MtCS