4

I am running iTerm2 (v 3.2.9) and zsh (v 5.7.1). I normally have 3-4 iTerm tabs opened at the same time and each tab has its own history thanks to the following settings in my .zshrc file

SAVEHIST=10000 # Number of entries
HISTSIZE=10000
HISTFILE=~/.zsh_history

unsetopt inc_append_history
unsetopt share_history
setopt appendhistory

However, when I close and re-open iTerm2 all tabs share the same history (I suppose they are reading from the very same HISTFILE): for example, if I have two tabs (say A and B), where the last command from A is foo and the last command from B is bar, when I close and re-open iTerm2 both tabs see either bar or foo (depending on the latest command which has been run, regardless of A or B) as the last entered command (arrow up key).

My question is: it is possible to keep separate histories even after re-launching iTerm2?

  • This isn't a real answer because I haven't done all the legwork, but it seems possible that you could have those different terminals be launched from different profiles, each with a different zsh command line that specified a different .zshrc file or dotfiles directory. That way those tabs would always come back with the options you prefer. I've searched a bit for this and I'm pretty convinced it could work. I can say for certain that I get a lot of mileage out of multiple iTerm2 profiles for building different local term sessions. – Br.Bill Aug 29 '19 at 17:21

You must log in to answer this question.

Browse other questions tagged .