gpt4 book ai didi

tmux - 使用 TMUX 在终端中启动 2 个垂直 Pane

转载 作者:行者123 更新时间:2023-12-01 04:46:31 25 4
gpt4 key购买 nike

我想使用 tmux 在终端窗口中并排启动 2 个 Pane :

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

虽然我认为很有可能做到,但要弄清楚如何使用文档来做到这一点是极其困难的。

我想创建一个面板,然后告诉面板运行哪个命令。

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

最佳答案

看起来您只是缺少 splitwsplit-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.

关于tmux - 使用 TMUX 在终端中启动 2 个垂直 Pane ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60330838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com