feat(zsh): if tmux session ask to exit

This commit is contained in:
thek4n 2024-03-05 23:24:42 +03:00
parent 933b1fc1d8
commit 154d778f7c
2 changed files with 16 additions and 1 deletions

View File

@ -38,7 +38,6 @@ alias path='echo -e ${PATH//:/\\n}'
# shorts
alias c='clear'
alias q='exit 0'
alias h='history 0'
alias j='jobs -l'

View File

@ -222,3 +222,19 @@ most-often-commands() {
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
}