Marco
Marco

Reputation: 4395

Vim: Changing pattern if nothing found?

If I ran a search pattern and nothing was found, is there a shortcut to bring it back for me to edit?

Upvotes: 2

Views: 127

Answers (3)

pestaa
pestaa

Reputation: 4749

Hit / and then .

Upvotes: 3

Dave Kirby
Dave Kirby

Reputation: 26572

The last search pattern is also saved in the / register. If you want to use it in another command (such as :s/...) then you can insert it in the command line with <CTRL-R>\.

Upvotes: 2

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799082

Typing the character for the appropriate mode (/ or :) and pushing the up arrow will recall previous commands of that type.

Upvotes: 5

Related Questions