If I have the following words
cat Oliver Louis
and the cursor is on "c", I can copy up to the beginning of Louis with y/Louis<CR>
(where "CR" is the enter key), which will copy the string "cat Oliver ".
Is there a way to copy the search term, "Louis", as well, for a copied string of "cat Oliver Louis"? Thanks in advance.
Use the /e
modifier: y/Louis/e<CR>
. If you want to repeat the last search pattern, just leave it out: y//e<CR>
.
:help search-offset
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