Search for selection in vim
Answer
- Yank the text you want to search for
- q/p
- Enter
Explanation
q/
works similarly to vanilla search /
except you're in command mode so p
actually does "paste" instead of typing the character p
. So the above will copy the text you're searching for and paste it into a search.
For more details type :help q/
Use q / instead of just /. (Same with q :). Now you can VIM-edit through your command and search history! (Try Ctrl-N and Ctrl-P sometime).
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