Skip to content

Instantly share code, notes, and snippets.

@tpendragon
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpendragon/f3052fc061863051f5b4 to your computer and use it in GitHub Desktop.
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.
#!/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