I've got some method calls all over the place in a large file, I'd like to match these lines, select and then yank them as one so I can put them all in a single place.
I can find all the lines I want with :g/>set
but how do I visually select each line?
You can't have multiple visual selections in Vim.
But you can clear a register and append all the matching lines to it:
:let @a = ''
:g/>set/y A
then create an empty buffer (or navigate to an existing one):
:vnew
and paste from register a
:
"ap
But you probably want something like TagList or TagBar.
edit
:[something]y a
means "yank into register a
".
:[something]y A
means "append to register a
".
What I usually do is :
:v/pattern/d
ggyG
p
u
to get the file back to its initial stateThis is a bit cumbersome, I would welcome a simpler solution.
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