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?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityYes, 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:
.
q:
. It's not exclusive to replaces, but it's a real buffer, so all of vim's power works there.
May 10, 2016 at 11:54
You can use :history s
for search history. As a shortcut, you can use :his s
. Same way for command line history also.
Just hit /
and then Ctrl-f
to bring up the search history directly under your cursor, scroll with motion keys and Enter
at whichever phrase you need to return to. Since I discovered that Ctrl-f
list I've never used awful distant Arrow keys to scroll over.
q/
is the same and even simpler. The only benefit of Ctrl-f
is when you're already in the search mode /
(or other mode) and want to bring up the history. Anyway thank you for the indication.