Reputation: 199
Is there some vim-magic to yank between two strings?
As example:
#%%
some example
or
some other
#%%
I would like to yank everthing in between (#%%)? Like the "yi(" command.
Upvotes: 1
Views: 479
Reputation: 4683
If you don’t care that :yank
is linewise, you could do
:/#%%/+,/#%%/- yank
Since patterns count as addresses, we can write a range that selects the inner text, and then yank it.
Upvotes: 0
Reputation: 11445
y
works with all motions, which includes /
.
/#%%
and then wyn
would accomplish what you want, where
/#%%
: search for the literal symbols #%%
. As long as your cursor was above the section you want to yank, this will highlight the first instance.
wyn
: move one w
ord forward, to not include #%%
in your yank (this assumes #%%
is space separated from everything you want to yank). yn
just means "y
ank all text until the n
ext instance of the search".
Upvotes: 4