Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: manually truncating histfile?
On Sat, Dec 28, 2024 at 10:06 AM Anthony Heading <ajrh@xxxxxxxx> wrote:
>
> I have SAVEHIST=0x4000000 to prevent the history file ever being automatically truncated before e.g. I can archive it.
>
> What's the best way then to explicitly truncate?
Something like this, I think:
truncate_histfile () {
local SAVEHIST=0
fc -W
}
This has to be run in an interactive shell. Alternately, to just
write out the current shell history:
save_this_history () {
local SAVEHIST=$HISTSIZE
fc -W
}
Might require addition of some "setopt localoptions ..." to change the
state of history sharing/appending depending on what you enable and
what you want the resulting behavior to be.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author