zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: dominik.vogt@gmx.de, Zsh Users <zsh-users@zsh.org>
Subject: Re: SSD-friendly history
Date: Wed, 5 Oct 2022 15:50:43 -0700	[thread overview]
Message-ID: <CAH+w=7Y1_9Y83pmzj7j0tEBRF25atwZ1Owp1kQY_xLL8C_jh6Q@mail.gmail.com> (raw)
In-Reply-To: <Yz34Wf67KJolrztr@localhost>

On Wed, Oct 5, 2022 at 2:34 PM Dominik Vogt <dominik.vogt@gmx.de> 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.


  reply	other threads:[~2022-10-05 22:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 21:34 Dominik Vogt
2022-10-05 22:50 ` Bart Schaefer [this message]
2022-10-05 23:19   ` Dominik Vogt
2022-10-06  6:10     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Y1_9Y83pmzj7j0tEBRF25atwZ1Owp1kQY_xLL8C_jh6Q@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=dominik.vogt@gmx.de \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).