# HG changeset patch # User Meredith Howard # Date 1481582493 18000 # Node ID 12d2866f8190513a7d550b9368a497a1b4b2c99c # Parent 8ef69d160a7281073758039a2fa0f4e50d820b01 add tmuxs helper diff --git a/bin/tmuxs b/bin/tmuxs new file mode 100755 --- /dev/null +++ b/bin/tmuxs @@ -0,0 +1,32 @@ +#!/bin/sh +set -eu + +case ${1:-} in *help|-h) + exec perldoc -T $0;; +esac + +name=${1:-$(basename `pwd`)} + +if tmux ls -F '#S' | grep -x $name >/dev/null; then + if [[ ${TMUX:-} ]]; then + exec tmux switch-client -t $name + else + exec tmux attach -t $name + fi +else + exec tmux new -s $name +fi + +:<<=cut +=head1 NAME + +tmuxs - Start or attach session based on cwd or given name + +=head1 SYNOPSIS + + tmuxs foobaz + + cd ~/proj/quux + tmuxs + +=cut