Avoid losing history when ssh connection drops
Solution 1:
This returns nothing:
env | grep HIST
Well, no, for two reasons:
- If it were controlled by an environment variable, but that variable hasn't been set, then you won't find it in the environment.
- It's not actually an env var that controls this, but a shell option.
Zsh has three relevant shell options for this : INC_APPEND_HISTORY
, INC_APPEND_HISTORY_TIME
and SHARE_HISTORY
. Note that all three are mutually exclusive: You should set only one of them, and not the others.
I vaguely recall setting a variable that shares history between tabs
It sounds like you want SHARE_HISTORY
. In that case, add this to your .zshrc
file:
setopt sharehistory # uppercase and underscores are optional
In future, if you want to check for a shell option on the command line, you can do this:
% set -o | grep hist
noappendhistory off
nobanghist off
cshjunkiehistory off
extendedhistory off
histallowclobber off
nohistbeep off
histexpiredupsfirst off
histfcntllock on
histfindnodups off
histignorealldups on
histignoredups off
histignorespace off
histlexwords off
histnofunctions off
histnostore off
histreduceblanks off
nohistsavebycopy off
histsavenodups on
histsubstpattern off
histverify off
incappendhistory off
incappendhistorytime off
sharehistory on
%