Zellij notes

Zellij is rich tool for terminal based workspace management

I am a heavy user of tmux for many years and it has been good experience. However, I thought of doing some experiments with zellij and see what it offers and can be more effective for my usecase. So here I will note some findings as I go along the way.

Setting it it easier, install standard package from your distro, on Mac e.g. there is brew formula so its straight forward.

the config is stored in ~/.config/zellij/config.kdl

Right now my config.kdl is just this

   theme "catppuccin-latte"

but I am sure I will add some tmux key pressed :slight_smile: soon.

starting a session

zellij

Detaching from session Ctrl+o d

Resuming an existing session zellij a

I have read through few things on Screencasts & Tutorials

and here is what my current session looks like. I am pretty happy thus far.

1 Like

Locking the jellij interface menu seems to immensely help in avoiding keymapping conflicts with underlying applications running in pane e.g. helix, weechat etc.

Default ( unlocked )

To lock

Ctrl + g

1 Like

I like Zellij a lot! Especially editing the scrollback and easy navigation – very nice. One keybinding conflict with Helix that I did notice is Ctrl-b, which I use for scroll-back a lot. In Zellij, Ctrl-g is used to switch to tmux mode, which I don’t want to use, so I disabled it with the following in ~/.config/zellij/config.kdl:

keybinds {
	shared_except "tmux" "locked" {
	//  bind "Ctrl b" { SwitchToMode "Tmux"; }
	    unbind "Ctrl b"
	}
}

Getting conflicts with Ctrl-o in helix (pop back up navigation stack) and Ctrl-t in tio. So ended up setting my keybindings so the movement keys work even in locked mode – this way I can keep it locked most of the time when working, and just enter Zellij unlocked mode to configure new tabs, look at scrollback, etc.

keybinds {
	shared_except "tmux" "locked" {
	//  bind "Ctrl b" { SwitchToMode "Tmux"; }
	    unbind "Ctrl b"
	}

	shared {
		bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
		bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
		bind "Alt j" "Alt Down" { MoveFocus "Down"; }
		bind "Alt k" "Alt Up" { MoveFocus "Up"; }
		bind "Alt m" { ToggleFloatingPanes; }
	}
}

(from a thread)

Also noticed that if I detach from a session, change the config, and re-attach, the config changes seem to stick – I think tmux required an entire restart when changing anything.

To re-order tabs:

  • bind “Alt i” { MoveTab “Left”; }
  • bind “Alt o” { MoveTab “Right”; }

The pane layout can be switched from vertical split to horizontal split with “Alt ]”

Adjusting pane size:

  • bind “Alt =” “Alt +” { Resize “Increase”; }
  • bind “Alt -” { Resize “Decrease”; }

Zellij remembers your sessions and tabs even after reboot and offers to start the program that was running when you quit Zellij – pretty slick!

Neat project and some remappings to avoid zellij and helix conflicts:

One of the neatest things about Zellij is you can have multiple windows open on the same session and view different tabs in those different terminals. In the below example, you can see two terminal windows, and each is displaying a different tab of the same Zellij session.

This is a game changer as you can have one Zellij session for a project, and then open up as many terminals as you want for the work you are doing. As mentioned before, Zellij saves all your tabs between reboots. Combined with the ability to use the mouse to select tabs and windows, this is shaping up to be a very nice tool!

Combined with Helix, LazyGit, and Yazi, the modern terminal environment is better than an IDE, and you can compose it to exactly what you want.

Another benefit to the latest generation of tools is they have sane defaults and don’t require a lot of configuration to get working.

Some great articles about Zellij:

The Zellij author is currently living off savings and donations – consider supporting him if you like this tool.

There is now a Unlock First (non-colliding) mode:

To get to this screen, press Ctrl-o, c, <tab>.

What this does is you need to press Ctrl-g first to get to any mode, and then after you execute the command it returns to locked mode.

Before, you had to toggle out of locked mode (Ctrl-G), and then lock again (Ctrl-G) – with this new mode, it locks automatically after the command saving you one keystroke. I find this a little more intuitive and may switch to leaving this on by default.

The new status bar at the bottom is nice in that it only takes one line instead of two.