tags:

views:

87

answers:

2

I am using slash for searching for stuff within vim. I'd like to use the regex that I used for search in a command (a substitute command to be exact). Is there a simple way to do it?

+5  A: 

Use the useful CTRL-R:

In the command line, if you are making a substitute command search with :, you can press CTRL-R and then / to insert the last search into the command line.

It's great that the opposite works too: If you are making a search with the slash, you can add your last command with CTRl-R and then :

Juan Calero
+9  A: 

the subtitute command will use the last search if you do not specify it, so just use:

:s//<replacement>
Peter van der Heijden