dotfiles/script/tmuxsess

23 lines
581 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
2021-03-31 10:47:59 +00:00
#
# Open a new tmux session named after the current directory with a basic
# development/editing environment.
#
# The session will be named after the current directory unless the desired name
# is passed as the only argument.
set -e
if [ -z "$1" ]; then
cwd=$(pwd)
sessionname=$(basename $cwd)
else
sessionname="$1"
fi
tmux new -d -s $sessionname
tmux rename-window -t $sessionname:1 cli
tmux new-window -t $sessionname -n vim -ic nvim
tmux select-window -t $sessionname:1
2021-04-13 15:59:03 +00:00
# https://github.com/tmux/tmux/issues/2064
sleep 0.5
tmux attach -t $sessionname