Skip to content

Instantly share code, notes, and snippets.

@angelamancini
Last active June 26, 2016 23:37
Show Gist options
  • Save angelamancini/48159f007c4cbcdd9c25 to your computer and use it in GitHub Desktop.
Save angelamancini/48159f007c4cbcdd9c25 to your computer and use it in GitHub Desktop.
hostname of vagrant box is the same as project folder
#!/bin/bash
SESSIONNAME=$(hostname -f)
cd /vagrant
echo "Moved to $(pwd)"
tmux has-session -t $SESSIONNAME 2>/dev/null
if [ "$?" -eq 1 ] ; then
echo "No Session found. Creating and configuring."
# new session with name $SESSIONNAME and window 0 named "base"
tmux new-session -s $SESSIONNAME -n base -d
tmux split-window -t $SESSIONNAME:0 -v
tmux resize-pane -D 5
tmux select-pane -t $SESSIONNAME:0 -U
tmux send-keys 'rs' Enter
tmux split-window -t $SESSIONNAME:0 -h
tmux resize-pane -L 15
tmux select-window -t $SESSIONNAME:0
else
echo "Session found. Connecting."
fi
tmux attach-session -t $SESSIONNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment