I often need to copy larger vertical selections e.g. when working with (let's stay civilized) "getter/setter"-rich interfaces, e.g
A very long line with something I would like to copy: ABC$
A short line with nothing$
A very long line with something I would like to copy: ABC$
Here I have used $
to indicated the end of the line. I now make a visual
vertical selection on e.g. the A
in the column 55 across all lines, yank it
and paste it with P
before that column and get extra whitespace inserted in
the second line.
A very long line with something I would like to copy: AABC$
A short line with nothing $
A very long line with something I would like to copy: AABC$
Is there a way to avoid the extra whitespace? Changing characters in the vertical visual selection doesn't seem to suffer from this issue.
This is how visual-block move works. You are copying column 55. Then pasting with P
. Your second line does not extend as far as column 55. So when you paste it will extend that line for you.
Use :reg
to look at your register. You will noticed A^J ^JA
as the value for ""
, the unnamed register. The ^J
symbolize line breaks. Notice the space between ^J
's. This is how a visual-block mode yank works with empty space, by filling it in with spaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With