tags:

views:

81

answers:

1

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 '.

+4  A: 

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.

Roger Pate
It's worth nothing that you can use `:let @a=@/` to store the last search in another register rather than pasting it into your document.
Alligator