drio

The never-ending value of tmux

I have spoken before about tmux here and I am going to continue doing so. Tmux is a foundational element in my cli flow. I recently watched this video where the presenter talks about his workflow in linux using i3, tmux and [neo]vim. He mentions multiple times that implementing his workflow in macOS is difficult. I'd like to discuss my implementation because I think it provides the similar functionality to his setup. He also touches on a tmux workflow that I think is very powerful and I'd like to echo it here.

He uses i3 as a window manager. I3 is a tiling window manager. This basically means the window manager places the windows for you in a tiling fashion as oppose to macOS where you have place your windows by using the mouse. I3 is basically tmux for your UI windows.

Hammerspoon

How do we get similar functionality in macOS? The answer is hammerspoon. HS is a piece of software that exposes OS functionalities via Lua (one of my favorite programming languages). The list of functionality it provides is impressive. One of them is being able to access windows and move them around. That is what I use to control my windows. What I have is not exactly what Prime shows on his video but I believe it gets me pretty close. I could iterate and make it better but I am happy with what I have and I think it makes me very efficient while interacting with macOS.

Tmux workflow

After talking about i3 he moves on to tmux. He mentions how he has tmux sessions mapped to projects (filesystem locations). He can be anywhere and very quickly jump to any project. He has specific shortcuts for projects that he works on often. For other projects he fuzzy finds across all his dev directory. The idea is that you can create a tmux session while navigating a filesystem and then you can use fzf to jump into those sessions you have available.

One of the key pieces here is this map between a directory location and a tmux session. It is more sensible than creating sessions and give them a custom name. You already communicate the meaning of the project when you create a directory, so use that when creating new tmux sessions. Very powerful.

You have to see this. For that, I have created a video. Enjoy:

-drio out