Запуск 2 вертикальных панелей в терминале с использованием TMUX - PullRequest
3 голосов
/ 21 февраля 2020

Я хочу запустить 2 панели бок о бок в окне терминала, используя tmux:

tmux \ 
  --vertical-pane='tsc -w' \
  --vertical-pane='nodemon --watch' \

Очень трудно понять, как это сделать с документацией, хотя я думаю, что это довольно можно сделать.

Я хочу создать панель, а затем сообщить панели, какую команду запустить.

https://gist.github.com/MohamedAlaa/2961058

Ответы [ 2 ]

1 голос
/ 29 февраля 2020

Похоже, вам просто не хватает splitw или 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"

Вот справочная страница tmux на 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.
0 голосов
/ 21 февраля 2020

Это близко, но я не знаю, как создать новую панель:

uuid="$(uuidgen)"
tmux new -d -s "$uuid"
tmux send-keys -t "${uuid}.0" "tsc -w" ENTER
tmux send-keys -t "${uuid}.1" "nodemon" ENTER
tmux a -t "$uuid"
...