feat(zsh): add tmux_attach function and alias to t
This commit is contained in:
@@ -79,3 +79,19 @@ function tssh {
|
||||
ssh -t "$@" "command -v tmux && (tmux a || tmux new-session -s gorazd -c ~) || bash"
|
||||
}
|
||||
|
||||
|
||||
function tmux_attach {
|
||||
tmux_running=$(pgrep tmux)
|
||||
|
||||
if ! [[ -z ${TMUX} ]]; then
|
||||
echo "already attached; refreshing env"
|
||||
source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p')
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -z $tmux_running ]]; then
|
||||
~/.config/tmux/tmux-sessionizer ~
|
||||
else
|
||||
tmux a
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user