From 293b3f86744832fdc577236fa88621fa9232724f Mon Sep 17 00:00:00 2001 From: David Morgan Date: Wed, 30 Nov 2022 16:12:56 +0000 Subject: [PATCH] Don't dettach other tmux sessions when connecting via ssh --- nix-conf/home/includes/zsh.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix index 7fdb666..c9d8926 100644 --- a/nix-conf/home/includes/zsh.nix +++ b/nix-conf/home/includes/zsh.nix @@ -81,7 +81,7 @@ }; initExtra = '' - # Taken from prezto tmux plugin + # Based on prezto tmux plugin if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && (-z "$SSH_TTY" || -n "$TMUX_AUTO_ATTACH") ]]; then tmux start-server @@ -89,7 +89,11 @@ tmux new-session -d -s "0" \; set-option -t "0" destroy-unattached off &> /dev/null fi - exec tmux -u attach-session -d + if [[ -n "$SSH_TTY" ]]; then + exec tmux -u attach-session + else + exec tmux -u attach-session -d + fi fi export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'