Currently I have zsh set up in such a way that command history is shared between all sessions immediately.
Say I have a terminal emulator open with two tabs, each with a zsh session, A1 and A2. If I enter ls -la in A1, and then go to A2 and press up arrow key, I will see ls -la in the command prompt.
I would like to change it so sessions don't share the command history with each other although when you start new session it gets all the previous history from all sessions before it.
Best Answer
You've probably got
INC_APPEND_HISTORY
set.The
INC_APPEND_HISTORY
option, fromman zshoptions
:The option that you want is
APPEND_HISTORY
:You can read about these options in the
man zshoptions
,man zshall
or online here.To set them, in your
~/.zshrc
or similar, you should have:Be aware that, if you're using oh-my-zsh by default, I believe,
INC_APPEND_HISTORY
is used. I'm not 100% sure which way around things get loaded, but if theoh-my-zsh
option overrides the one you've set in~/.zshrc
, you can fiddle with it in~/.oh-my-zsh/lib/history.zsh