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?
views:
1531answers:
2
+21
A:
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
CMS
2008-12-12 15:45:42
Very cool. CMS = fast + detailed.
Marcin
2008-12-12 15:54:03
@CMS. Thanks. Great tip! Using :reg to see what's in your registers and then using cntl-R N to get what's in register N is excellent!
Rob Wells
2008-12-15 20:22:10
CMS
2008-12-15 20:55:59
you are now officially my hero.
alesplin
2010-02-12 18:35:40