Skip to content

Instantly share code, notes, and snippets.

@kurtharriger
Created May 13, 2014 01:40
Show Gist options
  • Select an option

  • Save kurtharriger/e9b309081283756eee2c to your computer and use it in GitHub Desktop.

Select an option

Save kurtharriger/e9b309081283756eee2c to your computer and use it in GitHub Desktop.
tmux helper script
#!/bin/bash
DNAME=$(basename $(pwd))
if [ -n "$1" ]; then
NAME="$1"
if [ "$NAME" != "$DNAME" -a -d ~/projects/"$NAME" ]; then
cd ~/projects/"$NAME"
fi
else
NAME=$(basename $(pwd))
fi
if ! tmux has-session -t "$NAME"; then
TMUX= tmux new-session -s "$NAME" -d
if [ -f "project.clj" ]; then
tmux rename-window -t "$NAME" emacs
tmux send-keys -t "$NAME" 'emacs project.clj' C-m
tmux new-window -t "$NAME" -n test-runner
tmux new-window -t "$NAME" -n misc
tmux select-window -t "$NAME":0
fi
fi
if [ -z "$TMUX" ]; then
tmux attach -t "$NAME"
else
tmux switch-client -t "$NAME"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment