feat: auto connect to tmux if ssh

This commit is contained in:
max_richter 2022-01-31 15:13:23 +01:00
parent 5bd1403f91
commit a8e8852d66
2 changed files with 11 additions and 10 deletions

View File

@ -112,16 +112,6 @@ if ! shopt -oq posix; then
fi
fi
if ! command -v tmux &> /dev/null
then
echo "<the_command> could not be found"
exit
else
# Auto connect to tmux session of ssh
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
fi
fi
[ -z $DISPLAY ] && export DISPLAY=127.0.0.1:0.0
. "$HOME/.cargo/env"

View File

@ -75,5 +75,16 @@ fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Auto connect to tmux session of ssh
if command -v tmux &> /dev/null
then
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
fi
fi
export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"