Skip to content

Instantly share code, notes, and snippets.

@vnegrisolo
Last active February 3, 2017 21:55
Show Gist options
  • Save vnegrisolo/3e126de8168dd6305afe to your computer and use it in GitHub Desktop.
Save vnegrisolo/3e126de8168dd6305afe to your computer and use it in GitHub Desktop.
Open tmux with sessions and panes
#!/bin/sh
mux() {
if [ -z "$@" ]; then
echo 'usage ./tmux.sh <project_name> [<project2]';
fi
for project in "$@"; do
cd ${project};
project=${project%/};
project=${project//\./-}
tmux new -d -s ${project};
tmux rename-window -t ${project}:0 code;
tmux select-window -t ${project}:0;
tmux split-window -h 'vim .';
tmux new-window;
tmux rename-window -t ${project}:1 server;
tmux select-layout -t ${project}:0 main-vertical;
tmux select-window -t ${project}:0;
echo "New session on tmux=${project}";
cd ..;
done
echo "Tmux sessions:"
tmux ls;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment