Skip to content

Instantly share code, notes, and snippets.

Created April 10, 2012 22:44
What would you like to do?
Shell Script for tmux setup
cd ~/Sites/within3/big_red
tmux has-session -t ${SESSION_NAME}
if [ $? != 0 ]
# Create the session
tmux new-session -s ${SESSION_NAME} -n vim -d
# First window (0) -- vim and console
tmux send-keys -t ${SESSION_NAME} 'vim' C-m
# shell (1)
tmux new-window -n bash -t ${SESSION_NAME}
tmux send-keys -t ${SESSION_NAME}:1 'git status' C-m
# mysql (2)
tmux new-window -n mysql -t ${SESSION_NAME}
tmux send-keys -t ${SESSION_NAME}:2 'mysql -u <username> <database>' C-m
# server/debug log (3)
tmux new-window -n server -t ${SESSION_NAME}
tmux send-keys -t ${SESSION_NAME}:3 'bundle exec rails s' C-m
tmux split-window -v -t ${SESSION_NAME}:3
tmux send-keys -t ${SESSION_NAME}:3.1 'tail -f log/development.log | grep "DEBUG"' C-m
# rails console (4)
tmux new-window -n console -t ${SESSION_NAME}
tmux send-keys -t ${SESSION_NAME}:4 'pry -r ./config/environment' C-m
# Start out on the first window when we attach
tmux select-window -t ${SESSION_NAME}:0
tmux attach -t ${SESSION_NAME}
Copy link


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment