tmux new window in new session

This commit is contained in:
Simonas Narbutas
2018-07-27 09:10:36 +02:00
parent 22cb8a8c40
commit 2e41d7601d
3 changed files with 28 additions and 1 deletions

View File

@@ -1,10 +1,11 @@
if [[ "$TERM" == screen* ]] || [[ -n "$TMUX" ]]; then
if [[ "$TERM" == screen-256color ]] || [[ -n "$TMUX" ]]; then
return 1
fi
if tmux list-sessions && (tmux list-sessions | test -n "$0"); then
session_id=`date +%Y%m%d%H%M%S`
tmux new-session -d -t base -s $session_id
tmux select-window -t "$( tmux new-window -P -F \#{window_index} )"
tmux attach-session -t $session_id \; set-option destroy-unattached
else
tmux new-session -s base