Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Named searches in Vim?

Tags:

vim

Is there a way to save a search pattern to a register and then conjure it up with some quick command?

I'm thinking of the way vim uses named registers with q and @, and named marks with m and '.

like image 866
feuGene Avatar asked Feb 11 '26 20:02

feuGene


1 Answers

Enter the search pattern in a buffer somewhere, then yank/delete it into a register. Use ctrl-r+x, at the search prompt (/), to retrieve register x.

If you already searched for the pattern, use :let @x=@/ to assign it to register x.