Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Setup some variables needed for bootstrapping the environment
# Bootstrap a new session called "myproject"
tmux new-session -d -s myproject
# Rename the first window (using the session-name:id notation)
tmux rename-window -t myproject:0 "backend"
# Create and label three other windows, splitting the last one horizontally
tmux new-window -t myproject:1 -n "frontend:server"
tmux new-window -t myproject:2 -n "frontend:dev"
tmux new-window -t myproject:3 -n "git"
tmux split-window -h -t myproject:3
# Send commands to the windows, use "C-m" to emulate "enter"
# On window 1, Start the virtualenv and run the Python server.
tmux send-keys -t myproject:1 "pew workon myproject" C-m
tmux send-keys -t myproject:1 "cd ${REPOS}/myproject_web_client/server" C-m
tmux send-keys -t myproject:1 "python" C-m
# On window 2, move to the directory with the source code for the client, and start Vim
tmux send-keys -t myproject:2 "cd ${REPOS}/myproject_web_client/src" C-m
tmux send-keys -t myproject:2 "vim" C-m
# On window 3 setup Git. On the left launch an alias to watch the current tree, while...
tmux send-keys -t myproject:3.left "cd ${REPOS}/myproject_web_client" C-m
tmux send-keys -t myproject:3.left "git watchtree" C-m
# on the right keep a shell to interact with Git
tmux send-keys -t myproject:3.right "cd ${REPOS}/myproject_web_client" C-m
tmux send-keys -t myproject:3.right "git status" C-m
# Switch to window 0
tmux select-window -t myproject:0
# Force tmux to assume the terminal supports 256 colors and attach to the target session "myproject"
tmux -2 attach-session -t myproject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment