I want to start 2 panes side-by-side in a terminal window using tmux:
tmux \
--vertical-pane='tsc -w' \
--vertical-pane='nodemon --watch' \
It is extrememly difficult to figure out how to do this with the documentation, although I think it's quite possible to do.
I want to create a pane, and then tell the pane which command to run.
It looks like you're just missing splitw
or split-window
:
uuid="$(uuidgen)"
tmux new -d -s "$uuid"
tmux splitw -h -t "${uuid}:0.0"
tmux send-keys -t "${uuid}.0" "tsc -w" ENTER
tmux send-keys -t "${uuid}.1" "nodemon" ENTER
tmux a -t "$uuid"
Here's the tmux man page on splitw
:
split-window [-bdfhIvP] [-c start-directory] [-e environment] [-l size] [-t target-pane] [shell-command] [-F format] (alias: splitw) Create a new pane by splitting target-pane: -h does a horizon‐ tal split and -v a vertical split; if neither is specified, -v is assumed. The -l option specifies the size of the new pane in lines (for vertical split) or in columns (for horizontal split); size may be followed by ‘%’ to specify a percentage of the available space. The -b option causes the new pane to be created to the left of or above target-pane. The -f option creates a new pane spanning the full window height (with -h) or full window width (with -v), instead of splitting the active pane. An empty shell-command ('') will create a pane with no command running in it. Output can be sent to such a pane with the display-message command. The -I flag (if shell-command is not specified or empty) will create an empty pane and forward any output from stdin to it. For example: $ make 2>&1|tmux splitw -dI & All other options have the same meaning as for the new-window command.