Browse Source

Update tmu -z to calculate names automatically

Samuel W. Flint 3 years ago
parent
commit
11d7747b1b
1 changed files with 9 additions and 1 deletions
  1. 9 1
      tmu

+ 9 - 1
tmu

@@ -21,7 +21,15 @@ do
             XWINFLAG=true
             ;;
         z)
-            ${TERMCMD} -e tmux
+            NAME=$(tmux list-sessions -F '#S' | grep term | sort -r | head -n 1)
+            if [ -n "${NAME}" ] ; then
+                NUM=$(echo $NAME | cut -d- -f 2)
+                NUM=$(( NUM + 1 ))
+                NAME="term-${NUM}"
+            else
+                NAME=term-0
+            fi
+            ${TERMCMD} -e tmux new -s "${NAME}"
             ;;
         l)
             if [[ $XWINFLAG != "true" ]] ; then