Created
March 17, 2020 19:41
-
-
Save gentunian/09d7fee83104fe00828f68a285b91164 to your computer and use it in GitHub Desktop.
tmux code golf
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/sh | |
splitHorizontal() { tmux split-window -d -t 0 -h ; } | |
splitVertical() { tmux split-window -d -t $1 -v ; } | |
replicateM() { for i in `seq 1 $1`; do splitHorizontal; done } | |
splitEven() { for i in `seq 0 $1`; do splitVertical $(($i * 2)); done } | |
die() { echo $1 && exit 1; } | |
#[[ $1 -lt 1 || $1 -gt 3 ]] && die "Number of nodes needs to be between 1 and 3." | |
tmux new-session -d -s luke ; | |
tmux select-layout event-horizontal | |
replicateM $(($1 - 1)) | |
splitEven $(($1 - 1)) | |
tmux attach-session -d -t luke |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment