Eyes, JAPAN Blog > tmux(inator)

tmux(inator)

sascha

この記事は1年以上前に書かれたもので、内容が古い可能性がありますのでご注意ください。

Even though our machines are mostly running gorgeous graphical unser interfaces, I’m often drawn to the terminal for many tasks. The simplicity and focus on a task a time suits me very well.

I was using an instance of the default macOS Terminal with a number of tabs, but the approach didn’t scale well for me. I often have to jump between projects and each project requires their own environments. Maybe one time I only need 1 terminal window for git tasks, but another time I want to use a bunch to also keep local instances of API servers and their databases running. This made it necessary to juggle my tabs around too often.

Last week, as it finally became to unbarring, I closed all tabs except one and installed tmux using Homebrew. tmux can be thought of as an application that manages several terminal sessions at once. Convenient keybindings let the user navigation between the different sessions, name them and reorder them. Even a huge amount of terminal sessions can be managed in a convenient way.

One drawback of all this is, that tmux won’t persist the session and window configuration. After a reboot everything is needed to be set up again. This sounds awful at first, but all setups tmux is capable of producing can be scripted. With tmuxinator there is a very convenient way of defining tmux sessions using YAML to get environments up and running in no time.

I personally have a 2 basic sessions defined with tmuxinator. The first with separate windows for brew, a common shell (I use fish) and a terminal running “trans”, since I often need to translate some text from the clipboard. The second session contains windows connected to my always-on machine running a WeeChat to connect to Slack over their IRC Gateway and a couple of other windows.

In addition to these 2 basic sessions I defined separate sessions for each possible project I am working on. These usually have windows ready with documentation folders and several other windows containing the necessary git repositories. If it is necessary to follow several log outputs I define a fitting split-screen arrangement to be able to have everything at hand at once.

After booting my Mac I simply have to open a single-tab, fullscreen Terminal and start the sessions I need:

tmuxinator start work
tmuxinator start maintenance
tmuxinator start project1
tmuxinator start project2
...

I am not going to write about specific configurations and usage. tmux and tmuxinator are well documented; I would just be duplicating that. Instead, here are the links to the repositories and some useful articles:

* tmux
* Tmuxinator
* A tmux Crash Course
* tmux Cheat Sheet
* tmux Copy & Paste on OS X: A Better Future

 

  • このエントリーをはてなブックマークに追加

Comments are closed.