alias q to detach tmux

This commit is contained in:
thek4n 2024-03-06 15:13:47 +03:00
parent 37c0ef2741
commit 37eb4339fe
2 changed files with 7 additions and 16 deletions

View File

@ -99,7 +99,14 @@ alias dcd='docker-compose down'
alias drmc='docker container prune'
alias drmi='docker image prune'
# tmux
if [[ -n "$TMUX" ]]; then
alias q='tmux detach'
else
alias q='exit 0'
fi
alias td='tmux detach'

View File

@ -221,20 +221,4 @@ most-often-commands() {
# Disable tmux on remote machine
ssht() {
ssh -t "$1" 'TMUX=NO $SHELL -l'
}
q() {
if [[ -n "$TMUX" ]]; then
local REPLY
echo -n "Tmux session - you really want to exit? [Y/n] "
read REPLY
if [[ "$REPLY" == [Yy]* ]]; then
exit 0
else
echo "Press 'Ctrl+b d' to detach tmux session"
return 0
fi
fi
exit 0
}