We can retrieve search and replace history on IDEs and text editors. Likewise is there a search history or a way to retrieve previously searched expression in vim?


Yes, you have the history command:

:history /

Note that it can be used for /, :, =, >, ?, @, all, cmd, debug, expr, input and search.

Alternatively you can use the q:, q/ and q? commands to see previously entered commands and searches on a sepearate buffer. You can then modify as you want and replay them by pressing <CR>.

See :h :history, :h q:.


You can use :history s for search history. As a shortcut, you can use :his s. Same way for command line history also.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.