Mostafa Qanbaryan

Mostafa Qanbaryan

As a developer, I always wanted to have a blog and... this is it!

If you’re like me (chances are you are, because you’re here), you like to work with TMUX or Zellij in your workflow.

So I’m not gonna explain why you should and what’s the benefits of using them.

I just wanna tell you how I use Zellij in my current workflow as a team leader.

Zellij vs TMUX

First, I should say that I’ve tested TMUX for a few days and it’s really great.

I think performance-wise and plugin-wise, it’s really better than Zellij (this is just how I felt).

But because I do all my codings in terminal and NVim, supporting RTL is really important to me and TMUX has no support at all and that’s a deal-breaker for me.

Zellij Sessionizer

If you ever used Zellij, you know that it still lacks lots of TMUX features (and in that, important ones).

For example, one of the greatest workflow for working with TMUX, is TMUX sessions.

Zellij recently added a good plugin for managing sessions and switching them in-session. But it doesn’t work for me.

You see, I like to query zoxide and fetch all my directories and create sessions based on them.

Let me explain a little more:

  1. I would open Zellij

  2. Session manager opens and shows me a list of all of Zellij sessions AND my directories

  3. Now I could attach to a session, or creating a new session based on the directories

I like this workflow and it works great for my current situation

So what’s the problem

As I said earlier, Zellij has it’s own session manager and wouldn’t let anyone to change the list from outside.

Of course you could just clone the plugin and change it however you like.

Zellij has a zellij attach command, but it doesn’t work for switching between sessions.

What should we do now?

Recently, Zellij added a new feature for plugins named pipe.

It works just like the pipe in unix, in that you could pipe anything you want to a plugin.

So with this, I’ve put together a few lines and created Zellij attach plugin that let’s you just do that.

Zellij attach and how it works

Pipe the name and working directory of a new session to Zellij attach plugin and it’ll create a session for you, OR attaches to an already existing session with the same name!

I found an script for changing sessions and changed it a little to work with this plugin.

You could take a look and change it as you like. (The original script if from here).

This little script, opens up fzf and shows you a list of sessions and directories from Zoxide.

After selecting any session or directory, it will connect you to that session or create a session based on the directory

I should say that this plugin is not complete and just works, but I hope that in the future, zellij attach works in-session as well.

If you want to #HireMe, take a look at my resumé