Is there a nice way to do this without doing copy&paste manually?
You can certainly do all this with a single copy/paste (using block-mode selection), but I'm guessing that's not what you want.
UPDATE: An answer with this many upvotes deserves a more thorough explanation.
Many Ex commands accept a range of lines as a prefix argument - in the above case the 5,8 before the del and the 1,4 before the s/// specify which lines the commands operate on.
we'd need to specify a different delimiter, to prevent "work is" from being split into two list elements: let l=split(@","\n").
Finally, in the substitution s/$/\=remove(l,0)/, we replace the end of each line ($) with the value of the expression remove(l,0). remove(l,0) alters the list l, deleting and returning its first element. This lets us replace the deleted lines in the order in which we read them. We could instead replace the deleted lines in reverse order by using remove(l,-1).
An elegant and concise Ex command solving the issue can be obtained by combining the :global, :move, and :join commands. Assuming that the first block of lines starts on the first line of the buffer, and that the cursor is located on the line immediately preceding the first line of the second block, the command is as follows.
For detailed explanation of the technique used, see the answer I gave to the question "Vim paste -d ' ' behavior out of the box?".
The movement is not the best one (I'm not an expert), but it works like you wanted. Hope there will be a shorter version of it.
The first line of the starting block is not the longest, and you additional spaces to the end.
the number of lines in each group (3 in my example).
qa records everything up to the next q into a "buffer" in a.
ma creates a mark on the current line.
:5<CR> goes to the next group.
y$ yanks the rest of the line.
'a returns to the mark, set earlier.
$p pastes at the end of the line.
:5<CR> returns to the second group's first line.
'a returns to the mark.
jq goes down one line, and stops recording.
This method relies on the UNIX command line. The paste utility was created to handle this sort of line merging.
it were an endless source of empty lines.
Sample data is the same as rampion's.
Select block 123 and all below.
and then press @q (and you may subsequently use @@) as many times as needed.
There can be many number of ways to accomplish this. I will merge two blocks of text using any of the following two methods.
suppose first block is at line 1 and 2nd block starts from line 10 with the cursor's initial position at line number 1.
with a macro using the commands: copy,paste and join.
with a macro using the commands move a line at nth line number and join.
In vim, how do I paste a column of text to the end of irregular length lines?
Vim paste -d ' ' behaviour out of the box?