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

Re: SSD-friendly history



On Wed, Oct 5, 2022 at 2:34 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> I'd really like to have a mechanism that appends to the history
> until some maximum size is reached and then truncates it to some
> much smaller size

Setting INC_APPEND_HISTORY will cause the file to be rewritten only
when it reaches 20% larger than SAVEHIST.  There's no option to make
that greater than 20% at this point.

However, this would be a reason to make SAVEHIST a lot larger than
HISTSIZE.  If you don't mind using size-in-bytes instead of
size-in-lines, you could then add a fast check to .zlogout to set
SAVEHIST=$HISTSIZE whenever $HISTFILE is large enough.

(( $(zstat +size $HISTFILE) > 2000000 )) && SAVEHIST=$HISTSIZE

or similar.




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