Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In reverse-history-search in zsh, is there a maximum # of items it will go back?

Tags:

zsh

readline

I use control-r interactive reverse history search in zsh all day long. Just now I tried to find something I haven't used in quite some time, and it wasn't there. But when I grepped my .zsh_history file, it was there.

Is there a maximum # of history entries reverse search will search? Can I configure this?

like image 546
John Bachir Avatar asked Nov 21 '25 20:11

John Bachir


2 Answers

You can configure (in your .zshrc) how long the history per session and the stored one is:

HISTSIZE=5000 # session history size
SAVEHIST=1000 # saved history
HISTFILE=~/.zshistory # history file

That is what is searched by zsh, I am not aware of a limit that reverse-history-search uses.

You might want to check on the zsh-param(1) man page.

like image 150
Marcus Borkenhagen Avatar answered Nov 23 '25 11:11

Marcus Borkenhagen


In-memory history may not contain entries that are in the history file (if the file size limit is larger than the in-memory limit) and the history file may not contain entries that are in memory (until they're written - either explicitly or when the shell exits - subject to size limits set by environment variables). There is no other limit on reverse-history-search.

This is true in Bash and I believe the Z shell is similar.

like image 40
Dennis Williamson Avatar answered Nov 23 '25 12:11

Dennis Williamson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!