Handle shell history per-pane when TMUX is active

This commit is contained in:
Daniel McKnight 2026-05-08 10:36:22 -07:00
parent ba2d9ad2e8
commit d241365b88

8
.zshrc
View file

@ -104,6 +104,14 @@ if [ -z "${SUDO_USER}" ] && [ -z "${SSH_CONNECTION}" ] && [ -z "${TERM_PROGRAM}"
tmux new -A -s local_tmux
fi
# Use a history file per-pane in tmux
if [ -n "$TMUX_PANE" ]; then
hist_dir="${XDG_STATE_HOME:-${HOME}/.local/state}/zsh"
[ -d "$hist_dir" ] || mkdir -p "$hist_dir"
export HISTFILE="${hist_dir}/histfile.$TMUX_PANE"
setopt inc_append_history
fi
# Define a function to use autossh with a custom bashrc
function assh() {
remote_file=$(mktemp)