I search a way to paste/merge 2 block of text
block A
apple
pear
banana
block B
tomato
beans
potato
to this
apple tomato
pear beans
banana potato
I'm looking for an easy way to do this using macros.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityVisual block mode is a good route....
<C-V>
: we'll visually select the whole block...}k
is good (line count agnostic)$A<space><esc>
- this adds a space after every linegvd
- gv
recreates the previous visual selection, d
deletesMove cursor to "t" in tomato and hit P
to paste.
This can be used directly in a macro.
Update: I just remembered that I wrote a fairly substantial answer to a somewhat similar question: Add a block of text to end of lines. It doesn't have an exact answer to your question like I've written here but you might find it useful/interesting.
P
? Cursor first column, first line of second block?
--clean
. Either way when I get a sec I'll see if I can reproduce what you're seeing.
paste
command). OP didn't mention files so my answer is about two blocks of text in a buffer (or two buffers).