Basically I want to select and copy a bunch of non-sequential lines (some lines only partially) from different locations of a code, in a way that each yanked line is appended to clipboard register so that I can paste them all in another file. Everything in visual mode. It is possible to append to a register like
"Myy
and then pasting by "pm
but it is in command mode and we cannot copy a line partially.
1 Answer
You can use another register (e.g. a
) and the append to clipboard syntax (using the A
register)
To copy your first block you use it normally: "ay
To copy the following blocks you append to that clipboard: "Ay
These commands also work in visual mode: v"ay
and v"Ay
, respectively.
To paste it in another file you use it normally: "ap
v"My
does what you want.