From 37eb4339feaabc22fda7bd757cfb2132256b9f29 Mon Sep 17 00:00:00 2001 From: thek4n Date: Wed, 6 Mar 2024 15:13:47 +0300 Subject: [PATCH] alias q to detach tmux --- home/user/.config/bash/aliases | 7 +++++++ home/user/.config/bash/functions | 16 ---------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/home/user/.config/bash/aliases b/home/user/.config/bash/aliases index 630f835..f23318a 100644 --- a/home/user/.config/bash/aliases +++ b/home/user/.config/bash/aliases @@ -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' diff --git a/home/user/.config/bash/functions b/home/user/.config/bash/functions index 3600aff..d46e89a 100644 --- a/home/user/.config/bash/functions +++ b/home/user/.config/bash/functions @@ -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 } \ No newline at end of file