Created
March 17, 2014 17:33
-
-
Save pope/9604212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -r SESSION_NAME=work | |
# If we don't have a session, then create one with the default windows. | |
if ! tmux has-session -t $SESSION_NAME 2>/dev/null; then | |
# Create a new session with the first window named "emacs". Immediately detach. | |
tmux new-session -d -n emacs -s $SESSION_NAME | |
# Create a new window named dev. Repeat this for as many new windows you like. | |
tmux new-window -n dev -t $SESSION_NAME | |
# Start emacs in the emacs window. | |
tmux send-keys -t $SESSION_NAME:emacs '$EDITOR -nw' | |
# Go to the the code directory in the dev window. | |
tmux send-keys -t $SESSION_NAME:dev 'cd ~/code' C-m | |
# Select emacs so that we start here. | |
tmux select-window -t $SESSION_NAME:emacs | |
fi | |
# Attach tmux while detaching any existing clients. | |
tmux -2 -u attach -d -t $SESSION_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment