Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Infinite history size



14.12.13, 14:52, "Chris Down" <chris@xxxxxxxxxxxxxx>":
> 
> Hello,
> 
> I am looking to remove the upper limits on the history size in zsh.
> 
> In bash, and some other shells, this can be done by nullfying (note: not
> unsetting) HIST{,FILE}SIZE, and then making sure readline's
> "history-size" is -1. On zsh, doing the same thing with HISTSIZE and
> SAVEHIST results in HISTSIZE becoming 1, and SAVEHIST becoming 0.

It is not possible for history to occupy more memory then you have thus if you think there is no upper limit then you are false.

> 
> Setting an indiscriminately high number is not really appropriate -- I
> have years of (uniq'd by last usage) history that I would like to
> also import, and even that is fairly substantial:
> 
>     $ wc -l .bash_history
>     32539 .bash_history
> 
> Since I don't have any plans for this size to decrease, using a high
> number is probably not a wise idea.

You should determine how much memory you have, how much of it you can allow to be occupied by the history (AFAIK it is always fully loaded into memory) and act accordingly. Removing the limit is not wiser as it leaves you with an idea that there is no limit while it is always limited by available resources.

Or if you do not think you will ever hit a problem with resource exhaustion you can just set HISTSIZE to LONG_MAX from limits.h: it is the maximum number HISTSIZE can have.

> 
> 
> How can I do this in zsh?
> 
> Thanks.



Messages sorted by: Reverse Date, Date, Thread, Author