QUESTION:
I am deleting/copying every other line with :g/^/+d
However, when I try pasting all of those lines only the last line gets pasted. How do I paste every single line that I deleted/copied?
RESOLVED:
Thanks everyone! With your help I was able to finish my video (I work on a Youtube channel called Vim Girl where I make guided Vim Golf challenges.) Here's the link if you're interested: https://youtu.be/S9o5bHUAbP0
You can use a capital register to append to a register. First clear a register by either doing :let @a=''
or qaq
. Then execute your command.
:g/^/+d A
Now your results are in the "a
register. e.g. "ap
.
Assuming you are pasting this all at the bottom this could look like the following all together:
:let @a=''
:g/^/+d A
:$pu a
Note: this is equivalent to :g/^/+m$
For more help see:
:h :let-@
:h :d
:h quote_alpha
you could write a macro to append everything to the end:
qdddGp<ctrl + o>jq
then run it as many times (20, e.g.) as you need using:
20@d
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