15

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?

18

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:

:call histdel('/')

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 with vim -i NONE).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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