I spend quite a bit of time on the shell, more often than not inside a tmux session. For those of you not familiar with tmux, it is a terminal multiplexer (akin to GNU screen) allowing you to split your terminal into multiple windows and panes. Its a tool that offers man conveniences such as being able to start a session on a server, detach from it and to come back to later (in a different SSH session) or even having multiple people sharing a single session without having to physically be in the same place.
When developing with Ruby I tend to program using Vim in a tmux session. In my setup I usually have a window per project which has three panes: one for Vim, a second to run processes in (such as a rails web server) and a third as a console to run ad-hoc commands or an application console. With my configuration this setup looks something like the below screenshot:
![](https://without-brains.net/wp-content/uploads/2020/10/Screenshot-from-2020-10-03-15-30-17-1024x562.png)
While you can easily create the above panes with a few keystrokes, you can also script tmux to setup this up for you with a single key combination. This is what I will be diving into in this article.
Continue reading “Scripting tmux”