Last active
September 16, 2019 14:24
-
-
Save phcorp/f15df37444d21bb2e83f853a0f2721e8 to your computer and use it in GitHub Desktop.
terminal split function using tmux
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
## | |
# Splits a terminal vertically | |
# | |
# panes start synchronized, to desynchronize them, type: | |
# ctrl + b then :setw synchronize-panes | |
# | |
# usage: tsplit[ n] | |
# where n is an optional number | |
## | |
function tsplit() { | |
TSPLIT_WINDOWS=${1:-2} | |
COMMAND="tmux new-session \"tmux new-window \;" | |
for TSPLIT_WINDOW in `seq 2 $TSPLIT_WINDOWS` | |
do | |
COMMAND="$COMMAND split-window -d \;" | |
done | |
COMMAND="$COMMAND next-layout \; set-window-option synchronize-panes on\"" | |
eval $COMMAND | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment