当我使用带有8个窗格的tmux时,它会像这样平铺它们:

但我想让它们像这样平铺:

有什么方法可以自动完成这个任务吗?
发布于 2018-11-23 04:05:43
您可以使用tmux命令行自己制作窗格:
tmux splitw -v -p 20 -t ssh_tmux:0.0 #splits window0, pane0 vertically
tmux splitw -h -p 80 -t ssh_tmux:0.1 #splits the lower pane horizontally您必须使用-p来设置窗格的相对宽度,但是您可以通过一个命令编写一个bash脚本。
戴利:我不认为有一个简单的方法,但也不是不可能。
发布于 2019-01-15 19:41:49
下面的bash脚本适用于我:
tmux new -s logs -d
tmux splitw -v -p 50 -t logs:0.0
tmux splitw -h -p 75 -t logs:0.0
tmux splitw -h -p 66 -t logs:0.1
tmux splitw -h -p 50 -t logs:0.2
tmux splitw -h -p 75 -t logs:0.4
tmux splitw -h -p 66 -t logs:0.5
tmux splitw -h -p 50 -t logs:0.6
tmux attach -t logs发布于 2020-06-04 21:41:41
试试下面的bash脚本:
tmux new -s test -d
tmux selectp -t 0 # select the first (0) pane
tmux splitw -h -p 75 # split it into two horizontal parts
tmux selectp -t 0 # select the first (0) pane
tmux splitw -v -p 50 # split it into two vertical halves
# After this 3 panes will be created with pane number 0 (left- horizontal)
# Pane 1 (vertical pane under the pane 0)
# And Pane 2 with the remaining screen size
# Then we divide this remaining pane 2 into three similar panes
# repeat this till all 8 panes are created
tmux selectp -t 2 # select the new, second (2) pane
tmux splitw -h -p 66 # split it into two halves
tmux selectp -t 2 # select the second (2) pane
tmux splitw -v -p 50 # split it into two vertical halves
tmux selectp -t 4 # select the new, fourth (4) pane
tmux splitw -h -p 50 # split it into two halves
tmux selectp -t 4 # select the fourth (4) pane
tmux splitw -v -p 50 # split it into two halves
tmux selectp -t 6 # select the new, sixth (6) pane
tmux splitw -v -p 50 # split it into two halves
tmux selectp -t 0 # go back to the first pane
tmux attach -t test诀窍是识别pane number并对其进行相应的拆分。将以下行添加到上面的脚本中,您可以看到窗格编号以及tmux是如何排列窗格编号的。
tmux send-keys -t 0 'echo "-- Pane 1 ---"' Enter
tmux send-keys -t 1 'echo "-- Pane 2 ---"' Enter
tmux send-keys -t 2 'echo "-- Pane 3 ---"' Enter
tmux send-keys -t 3 'echo "-- Pane 4 ---"' Enter
tmux send-keys -t 4 'echo "-- Pane 5 ---"' Enter
tmux send-keys -t 5 'echo "-- Pane 6 ---"' Enter
tmux send-keys -t 6 'echo "-- Pane 7 ---"' Enter
tmux send-keys -t 7 'echo "-- Pane 8 ---"' Entersend-keys会将命令echo "-- pane number --"发送到-t选项指定的窗格。
https://stackoverflow.com/questions/53433705
复制相似问题