Skip to content

Instantly share code, notes, and snippets.

@penland365
Created May 19, 2015 22:09
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 penland365/569559ae512f6cf7b662 to your computer and use it in GitHub Desktop.
Save penland365/569559ae512f6cf7b662 to your computer and use it in GitHub Desktop.
Basic Tmux Script
#! /usr/bin env bash
SESSION_NAME=""
tmux has-session -t $SESSION_NAME &> /dev/null
if [ $? -ne "0" ]
then
tmux new-session -d -s $SESSION_NAME
tmux split-window -h -p 40
tmux split-window -v -p 40
tmux send-keys -t 0 "vim" C-m
tmux send-keys -t 1 "./sbt" C-m
tmux select-pane -t 0
fi
tmux attach -t $SESSION_NAME
@barrettclark
Copy link

Why not make this generic and take a parameter from the command line? Then you can put this in your ~/bin or whatever.

Line 3 maybe becomes something that looks like this:

[[ $1 == "" ]] && exit 0 || SESSION_NAME=$1

Being generic you wouldn't want the sbt command up in there, so maybe you go with a BOTH sort of thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment