zsh-users
 help / color / mirror / code / Atom feed
* Problems with history on macOS
@ 2024-02-14 17:08 Perry Smith
  2024-02-14 23:42 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Perry Smith @ 2024-02-14 17:08 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 2424 bytes --]

I’ve been fighting this for a year and I guess I will come to the experts.

I want to have one single giant history file and I can’t seem to get that.  It has hovered around 1500 lines.

In /etc/zshenv I have:

> if [[ -z "$XDG_CONFIG_HOME" ]]
> then
>         export XDG_CONFIG_HOME="$HOME/.config"
> fi
> 
> if [[ -z "$XDG_CACHE_HOME" ]]
> then
>         export XDG_CACHE_HOME="$HOME/.cache"
> fi
> 
> if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
> then
>         export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
> fi

I don’t recall if that is stock macOS or not.  The result is:

> XDG_CACHE_HOME=/Users/pedz/.cache
> XDG_CONFIG_HOME=/Users/pedz/.config
> ZDOTDIR=/Users/pedz/.config/zsh

/Users/pedz/.config/zsh/.zshenv is a symbolic link… sometimes that makes a difference so I’ll mention it.

In there I have (amount other things)

> export SHELL_SESSIONS_DISABLE=1
> export SHELL_SESSION_HISTORY=0


I added the DISABLE line a year ago.

In my login (also symbolically linked) is:

> : ${HISTFILE:=${ZDOTDIR:-$HOME}/.zsh_history}
> SAVEHIST=1048576
> (( HISTSIZE = SAVEHIST * 2 ))

If I do: env|grep SESS I get:

> TERM_SESSION_ID=C5339770-2EA7-49CA-A308-355511F0EE71
> SHELL_SESSIONS_DISABLE=1
> SHELL_SESSION_HISTORY=0

And if I do:  set | grep HIST  I get:

> HISTCHARS='!^#'
> HISTCMD=1585
> HISTFILE=/Users/pedz/.config/zsh/.zsh_history
> HISTSIZE=2097152
> LESSHISTFILE=/Users/pedz/.cache/less/history
> SAVEHIST=1048576
> SHELL_SESSION_HISTORY=0

The absurd 1M and 2M numbers I put out of frustration.

As you can see, my current history is about 1500 lines long.

Here are the pertinent options I have set — many I set explicitly in my login file:

> appendhistory := on
> banghist := on
> cshjunkiehistory := off
> extendedhistory := on
> histallowclobber := off
> histappend := on
> histbeep := on
> histexpand := on
> histexpiredupsfirst := on
> histfcntllock := off
> histfindnodups := on
> histignorealldups := on
> histignoredups := on
> histignorespace := off
> histlexwords := off
> histnofunctions := off
> histnostore := on
> histreduceblanks := on
> histsavebycopy := on
> histsavenodups := on
> histsubstpattern := off
> histverify := off
> incappendhistory := off
> incappendhistorytime := off
> sharehistory := off


Please let me know if you see what I’m doing wrong.

Thank you for your time,
Perry



[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with history on macOS
  2024-02-14 17:08 Problems with history on macOS Perry Smith
@ 2024-02-14 23:42 ` Bart Schaefer
  2024-04-14 17:57   ` Chris Nebel
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2024-02-14 23:42 UTC (permalink / raw)
  To: Perry Smith; +Cc: zsh-users

On Wed, Feb 14, 2024 at 11:08 AM Perry Smith <pedz@easesoftware.com> wrote:
>
> I want to have one single giant history file and I can’t seem to get that.  It has hovered around 1500 lines.

The only thing I can see is that you have all possible duplicate
removal options enabled, so unless you're issuing more than (about)
1500 lexically distinct commands, that's all you're going to have
saved.

The SHELL_SESSIONS stuff is not going to affect zsh at all, it doesn't
recognize either of those.  However, what might be happening is that
your desktop manager is running other zsh processes for its own
purposes (launching new windows, say) and those shells are getting
SAVEHIST set but to a smaller value, coming from an earlier config
file (and without the login option set so your .zlogin settings don't
override).

Run
  zsh -o sourcetrace
and check the output for assignments to the *HIST* variables.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with history on macOS
  2024-02-14 23:42 ` Bart Schaefer
@ 2024-04-14 17:57   ` Chris Nebel
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Nebel @ 2024-04-14 17:57 UTC (permalink / raw)
  To: zsh-users; +Cc: Perry Smith, Bart Schaefer

> On Feb 14, 2024, at 3:42 PM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> On Wed, Feb 14, 2024 at 11:08 AM Perry Smith <pedz@easesoftware.com> wrote:
> 
>> I want to have one single giant history file and I can’t seem to get that.  It has hovered around 1500 lines.
> 
> The only thing I can see is that you have all possible duplicate
> removal options enabled, so unless you're issuing more than (about)
> 1500 lexically distinct commands, that's all you're going to have
> saved.
> 
> The SHELL_SESSIONS stuff is not going to affect zsh at all, it doesn't
> recognize either of those.


It is if you’re on macOS — it disables the per-session history and state restoration that’s in /etc/zshrc_Apple_Terminal.


—Chris N.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-14 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14 17:08 Problems with history on macOS Perry Smith
2024-02-14 23:42 ` Bart Schaefer
2024-04-14 17:57   ` Chris Nebel

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).