Searching again with //

If you’ve searched for something and want to repeat the search again, just use //.

For example, if you run:

/foo

To search forward for foo, and then later on you want to repeat this search, you can simply run:

//

This also works in substitutions. Say you’ve searched /foo and now want to replace it, there’s no need to type foo again:

:%s//bar/g

Will replace all instances of foo with bar (presuming /foo was your last search).

comments powered by Disqus… Click Here