feuGene
feuGene

Reputation: 3991

Named searches in 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 '.

Upvotes: 3

Views: 161

Answers (1)

Roger Pate
Roger Pate

Reputation:

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.

Upvotes: 5

Related Questions