I use vim and vim plugins for visual studio when writing C++. Often, I find myself wanting to search for a string within a function, for example every call to object->public_member.memberfunc()
.
I know vim offers a convenient way to search for a single word, by pressing *
and #
, and it can also search for typed strings using the ubiquitous slash /
command. When trying to search for all the instances of a longer string like the one above, it takes a while to re-type after /
.
Is there a way to search for selection? For example, highlight with v
, then copy with y
, is there a way to paste after /
? Is there an easier shortcut?
Check this Vim tip: Search for visually selected text
Or you can simply yank the selected text with y and go to search mode /, then you can paste the last yanked text with Ctrl+R 0