If you search something in Vim by prepending searchterm with a forward slash, e.g. /searchterm
, Vim puts that searchterm into the search string history table. You then are able to navigate through past search terms by typing in forward slash (/
) and using Up/Down arrow keys.
That search string history table is persistent across Vim restarts.
Everything above is also true for command (typed with :
prepended) history table.
How do I clear those history tables?
Best Answer
The history is persisted in the viminfo file; you can configure what (and how many of them) is persisted via the
'viminfo'
(and'history'
) options.You can clear the history via the
histdel()
function, e.g. for searches:You can even delete just certain history ranges or matching lines.
Alternatively, you could also just edit the
~/.viminfo
file directly (when Vim is closed, and either with another editor, or withvim -i NONE
).