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

Re: Duration not written to history file



On Fri, Oct 20, 2023 at 12:49:52PM -0700, Bart Schaefer wrote:
> On Fri, Oct 20, 2023 at 5:43 AM Andreas Kähäri <andreas.kahari@xxxxxx> wrote:
> >
> > When starting a fresh interactive zsh session, setting HISTFILE and
> > SAVEHIST and enabling the EXTENDED_HISTORY and SHARE_HISTORY options,
> > the duration of commands is not written to the history file:
> 
> SHARE_HISTORY writes the line to the file as soon as it's accepted,
> rather than waiting until the command completes, so there is no
> duration available.  This does not appear to be clearly documented,
> although INC_APPEND_HISTORY_TIME says:
>      This option is only useful if INC_APPEND_HISTORY and SHARE_HISTORY
>      are turned off.  The three options should be considered mutually
>      exclusive.
> 
> > If this is not a bug, how should I set things up to get the duration of
> > commands written to the history file in a shared history setup?  Ideally
> > without using any hooks that runs "fc -W" after each command or similar
> > (that would be a hack IMHO).
> 
> Well, hack or not, the doc for SHARE_HISTORY says:
>      If you find that you want more control over when commands get
>      imported, you may wish to turn SHARE_HISTORY off,
>      INC_APPEND_HISTORY or INC_APPEND_HISTORY_TIME (see above) on, and
>      then manually import commands whenever you need them using `fc -RI'.

Thanks for the reply.  This gave me a bit more of an understanding of
how those options work.  I will probably have to revisit how I manage
the shell history in my setup.

-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.




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