Zend certified PHP/Magento developer

Avoid losing history when ssh connection drops

When I switch VPN or close my laptop, my ssh connection breaks – which is acceptable. BUT I want to be reminded what I was doing when it was last running (often I’m using rsync to move files around).

But when I execute history those commands don’t appear. While I don’t know exactly when zsh commits the history, it seems like it doesn’t write it to .zsh-history as soon as the command is invoked.

Does ZSH have a way to add commands to .zsh-history immediately?

Other info

I vaguely recall setting a variable that shares history between tabs, but I can’t find it (apparently that’s not enough anyway). This returns nothing:

env | grep HIST