Vim using the last regex search in the command: s

I use slash to find things in vim. I would like to use the regular expression that I used to search for a command (more precisely, command substitution). Is there an easy way to do this?

+5
source share
2 answers

the subtitle command will use the last search unless you specify it, so just use:

:s//<replacement>
+12
source

Use the useful CTRL-R:

At the command prompt, if you are replacing a command search with :, you can press CTRL-R and then / to insert the last search on the command line.

, : , CTRl-R, :

+6

All Articles