Last active
August 29, 2015 14:17
-
-
Save tpendragon/f3052fc061863051f5b4 to your computer and use it in GitHub Desktop.
Automate launching my dev environment in a tmux session for a project folder.
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 | |
string=`tmux list-session` | |
directory_name=`basename $PWD` | |
if [[ $string == *$directory_name* ]] | |
then | |
tmux new-session -As $directory_name | |
else | |
tmux -2 new-session -As $directory_name -d | |
tmux split-window -h | |
tmux select-pane -t 1 | |
tmux send-keys "vim ." C-m | |
tmux select-pane -t 2 | |
tmux split-window -v | |
tmux select-pane -t 1 | |
tmux -2 attach-session -t $directory_name | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment