Skip to content

Instantly share code, notes, and snippets.

@urbanautomaton
Created August 23, 2012 11:50
Show Gist options
  • Save urbanautomaton/3435922 to your computer and use it in GitHub Desktop.
Save urbanautomaton/3435922 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
project=$1
if [ -n "$2" ]; then
session_name=$2
else
session_name=$1
fi
directory="${HOME}/dev/${project}"
database="${project}_development"
original_pwd=`pwd -P`
cd $directory
tmux new-session -d -s $session_name
tmux set-option -t $session_name default-path $directory
tmux rename-window -t ${session_name}:1 'db'
tmux send-keys -t ${session_name}:1 "mysql -u root -D ${database}" C-m
tmux new-window -t ${session_name}:2 -n 'work'
tmux send-keys -t ${session_name}:2 "vim ." C-m
tmux new-window -t ${session_name}:3 -n 'bash'
tmux new-window -t ${session_name}:4 -n 'bash'
tmux split-window -t ${session_name}:2
tmux split-window -t ${session_name}:2
tmux select-layout -t ${session_name}:2 '58a0,272x62,0,0[272x45,0,0,272x16,0,46{136x16,0,46,135x16,137,46}]'
tmux attach
cd $original_pwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment