Gustavo Santos

Thoughts on Zellij

As a Tmux user for years, maybe Zellij could become one of my daily tools... in the future.

I’m a daily user of Tmux for a long time. My current job requires me to write code every day, but also navigate and find things quick. This is also the reason that I like Vim (NeoVim) so much, I can navigate and find things fast.

As a software engineer, I need to deal with front-end and back-end applications and their dependencies, such as running things on Docker, finding logs, running tests and so on, and for that, I usually use multiple Tmux sessions to have at least two sessions running at the same time: one for front-end development and another for back-end development.

Sometimes I need to have even more sessions, one for my notes (I took notes on my terminal during development), another to quickly navigate to another repository and so on. So, Tmux sessions are a must-have for me.

So, why expend time playing with Zellij?

Zellij got my attention because it offers many features out of the box. The UI is pretty nice, and it’s implemented in Rust. I thought that it could be nice to have some time playing with Zellij.

It turns out that Zellij is spectacular! It’s simple and very user-friendly.

I found it very easy to install and get started, but some defaults aren’t clear for me. For example, I have many NeoVim mappings using Ctrl key, such as Ctrl+p to find files, Ctrl+o to navigate through Vim’s jump list, Ctrl+t to open an embedded terminal in NeoVim to run a command (yes, yes, maybe this isn’t the best idea, but it’s quick and easy to hit Ctrl+t to toggle a terminal inside the editor).

I took some time to figure out that Zellij offers the option to lock these Ctrl mappings. When I did, I found it brilliant.

You just need to press Ctrl+g and then every combination of Ctrl (unless Ctrl+g) is then sent to NeoVim. You can unlock by pressing Ctrl+g again. In the second day, this toggling between locked and unlocked was natural.

Floating windows are a thing that I never thought that I need them. But it turned out to be very useful. I found me using floating windows to run commands, searching within logs, editing files, running tests and so on.

Zellij also improves the user experience when running tests. It’s easy to just fire npx jest path/to/file then rerun the test by pressing Enter key.

Also, it’s pretty easy to integrate Zellij with NeoVim to run commands. For example, I have set a mapping to run the current test file in a new floating pane:

nmap <leader>tr :!zellij run -f -- npm run test --bail %<CR>

Then I found the biggest con (at least to me) using Zellij, it’s impossible, or at least very slow to switch between sessions.

I need to switch between sessions a lot during the day. Having to detach from a session and attach to another session is cumbersome. In Tmux, there are many alternatives to quick switch between sessions, but Zellij makes it impossible for now. If at least Zellij had a way to, from inside a session, switch to another session, for instance running a command like zellij switch-session <session name>, maybe it could make Zellij more nice to use daily.

I’m sure that Zellij team or the community will bring with a solution for this in the future. If they do, it’s certain that I’ll switch from Tmux to Zellij.

Zellij is a solid piece of software and I hope that it will become even better.