Tmux to Zellij
My requirements of tmux are simple. I want to be able to partition my terminal into different panes, switch between panes with vim key bindings, and create tabs. Tmux should solve all these requirements. To sweeten the deal, tmux is one those CLI tools that can be found (or easily installed) on remote servers.
Current Workflow
My current workstation is running NixOS. I am using the KDE Plasma desktop environment, but I still get the itch for a keyboard centric workflow found in tiling window managers. Here is an example of how I start working on a project.
- I
cd
into my projects directory - If, my project’s dependencies can be met by my semi-global development flake, I run
nix develop
to load the environment. Otherwise, Icd
into my the actual project directory and runnix develop
with the project specific flake - I create about 4 panes. 1 to launch intellij idea, 1 for docker which hosts my database, 1 for running my Spring Boot application, and 1 for general terminal usage and version control
- Depending on my mood, I will create another tab with my second frontend terminal panes. I may also decide to just open another terminal window and switch between them using alt-tab
My Gripes with tmux
- I need a specific config file to setup vim key binds. This is solvable but still
- Scrolling upwards is weird. Sometimes it works, sometimes it doesn’t. Copying and pasting also sends you back to the lowest point in the terminal. In general, highlighting text feels weird.
- Remembering shortcuts to do certain actions with
C-b
prefix. It just isn’t intuitive to me - The worst of them all, vim inside of tmux is slow. I think it is a weird integration issue between my nix environment and vim. Changing modes in vim has a HUGE and annoying delay. I tried every fix I could from googling and AI and it just wouldn’t work. Strangely, on my thinkpad t480 running arch linux, running vim inside of tmux is snappy and just works. On my NixOS desktop with a ryzen 7700x, changing modes is slow and clunky. I don’t even use vim for my coding projects, but I still use it to edit config files. So, for the rare times that I am in tmux and I want to use vim, it is awful. This was the straw that broke the camel’s back
I guess what I’ve written are just a bunch of skill issues. I think they can all be solved with some kind of work around, but I was here to work on my web app, not to mess around with a tool for half an hour. One of the reasons why I am on a desktop environment is to not worry about setting up a ton of configuration.
Zellij Is the Solution
I had previously heard of zellij reddit posts and the like. I even know that DHH uses it in his Omakub setup. But I had brushed it aside as just another alternative in the sea of open source.
I also was convinced that having it be a tool available on remote servers would make it worth it. It is kind of the reasoning of “just use defaults” that I have with certain programs such as bash. But you know what? This assumption or justification is kind of baseless. I haven’t worked on a remote server in years and I don’t know if I will ever need to use the power tmux on a remote server. The session saving feature is nice, but it also exists in zellij. In other words, it was a premature optimization. I was preparing for a situation that would most likely never happen, and this caused me to not try out zellij.
After dealing with tmux’s problems, I gave zellij a shot. Zellij just works. There are clear shortcut suggestions at the bottom for quickly creating panes, creating tabs, and even switching panes (I didn’t get that far with tmux). It feels more modern too and there are vim key binds for changing focus right out of the box. No need for another config file. I know that adding a config file is not the end of the world (especially with how powerful home-manager is), but I love that zellij requires no configuration.
And lastly, opening vim in zellij has no slowdowns. No more waiting half a second when changing between modes. Half a second doesn’t sound like a lot, but when you have vim muscle memory and can write at the speed of thought, half a second is a jarring interruption.
Conclusion
I have once again learned to not let low percentage future events to influence current choices. Instead, trying new things for a little bit is at worst 10 minutes gone, and at best the discovering of a new and slick tool. Zellij is awesome and I foresee myself continuing to use it on my future development machines.