From fd74f0fd91737fe8458d72a38e0c5eb1f8d22705 Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 9 Feb 2021 19:08:51 +0100 Subject: [PATCH] auto launch tmux on ssh --- zsh/.zshrc.d/prompt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zsh/.zshrc.d/prompt b/zsh/.zshrc.d/prompt index 453be3d..1620e10 100644 --- a/zsh/.zshrc.d/prompt +++ b/zsh/.zshrc.d/prompt @@ -16,6 +16,15 @@ else eval `dircolors ~/.dircolors/dircolors.ansi-dark` fi zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} + +#launch tmux on ssh connection + +if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then + tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux +fi + + + if [ -z "$SSH_AUTH_SOCK" ] ; then eval `ssh-agent -s` fi