Tmuxomatic: Managing tmux sessions
With the popularity of tmux, the number of peripheral tools has gradually increased. Tmuxomatic schedules a tmux window session in a way called windowgram. Once the session is organized and saved to a file, it can be reused multiple times. Compared with manual operations, it seems to be a lot easier.
Tmuxomatic requires Python 3 and tmux 1.8 and later versions. You can run the following command to install tmuxomatic:
pip install tmuxomatic
It is worth noting that the tmuxomatic 2.18 installed in this method has a bug. If the tmuxpane-base-indexIf the value is not 0, tmuxomatic will report that it cannot be found.pane 0. However, tmuxomatic's git version has been fixed.
When tmuxomatic is used for the first time, we executetmuxomatic -f demo_sessionTo draw windowgram.
Enternew cliCreate a window named cli. At this time, the screen displays number 1 as the identifier.
To facilitate subsequent operations1To 30 characters in width and 10 characters in height:
scale 30x10
Currently, there is only one pane. We will add another pane on the right, with the same width as 1:
add right 100%
Now we have two panes 0 and 1. If you need more panes, you can also usebreakOrsplitCommand. Here we usesplitTo split 0:
split 0 bottom 5 2
In this way, the pane 0 is changed to 0 and 2, and the height is the same.
If you no longer need other operations, You can executedone. Then, tmuxomatic will create this session for us. RunexitOnly the results are saved.
After drawing windowgram, we can add other operations for the pane as needed, such as executing programs, transferring to a directory, and focusing.
1 run vim0 dir ~/code/linuxtoy.org2 foc
Run Vim in pane 1, and go~/code/linuxtoy.orgDirectory, and focus on pane 2.
Passcat demo_sessionLet's look at the final result:
##------------------------------------------------------------------------------#### Session file created by tmuxomatic flex 2.19-dev####------------------------------------------------------------------------------## Window added by tmuxomatic flex 2.19-devwindow cli1111111111111111111111111111110000000000000000000000000000001111111111111111111111111111110000000000000000000000000000001111111111111111111111111111110000000000000000000000000000001111111111111111111111111111110000000000000000000000000000001111111111111111111111111111110000000000000000000000000000001111111111111111111111111111112222222222222222222222222222221111111111111111111111111111112222222222222222222222222222221111111111111111111111111111112222222222222222222222222222221111111111111111111111111111112222222222222222222222222222221111111111111111111111111111112222222222222222222222222222221 run vim0 dir ~/code/linuxtoy.org2 foc
To create a tmux session, you only need to executetmuxomatic demo_sessionYou can.
→ Tmuxomatic
You may also like the following articles about Tmux:
Tmux: terminal multiplexing
Simple tmux tutorial
Tmux getting started
Build IDE with Tmux and Vim
Install and use Tmux in CentOS
Build IDE with Tmux and Vim
Tmux details: click here
Tmux: click here
This article permanently updates the link address: