Reputation: 719
Let us say that I yanked the following word: Cheese. Now I want to find Cheese within a text document. I hit the forward slash key(/)... and this is where I end. Is there a way to search with Yanked word? Also, is there a way you can use yanked words in substitution(s:/yanked/beef/g)?
Upvotes: 71
Views: 14275
Reputation: 420
q/: open the search history
pEnter: paste the yanked text on the command line and search
Upvotes: 36
Reputation: 827198
The most recently yanked text will be stored in the 0
and "
registers (if no register was explicitly specified e.g. by "xy
).
Then you can paste the text of any that register in the last line (either in search mode / or in last line command mode : ) with Ctrl-RX, where X
is the register you want to paste.
For example:
/Ctrl-R0
Will paste the contents of the register 0
in the forward search command pattern.
Upvotes: 134