Helix and Zellij

I really like the Helix text editor among all the common ones, for its simplicity and its support out of the box for every language I use.

The only thing I'm missing is a valid way to call the terminal from it, and make the terminal open in the same path I'm working on.

To accomplish this I'm using Zellij which is a terminal multiplexer with batteries included, indeed it is presented as a terminal workspace.

Zellij Configuration

Zellij allows you to create some custom layouts, that can be invoked at startup, to better adapt it to the work you are going to do.

The following is mine configuration to work with the Helix text editor. I have saved this configuration under this path ~/.config/zellij/layouts/helix.kdl:

layout {
    pane size=1 borderless=true {
        plugin location="zellij:tab-bar"
    }
    pane {
        command "hx"
        args "."
    }
    pane split_direction="vertical" size="20%" {

    } 
    pane size=2 borderless=true {
        plugin location="zellij:status-bar"
    }
}

Which results in the following layout:

image

Helix running in the top pane with a terminal console in another pane at the bottom, in the same path of the project I'm working with!! and this is exactly the goal I wanted to achieve.

System Configuration

Now to launch zellij with the custom layout and an instance of Helix I need to run:

zellij --layout ~/.config/zellij/layouts/helix.kdl

From the path I want to run Helix from.

Now to simplify that command i created an alias zhx and saved it inside my ~/.bashrc file.

alias zhx='zellij --layout $HOME/.config/zellij/layouts/helix.kdl'

With this configuration, every time I need to spawn a new instance of Helix, I just need to write zhx inside the directory I want to work with and Zellij will call Helix for me and make it open the project automatically.


You'll only receive email when they publish something new.

More from Pietrangelo Masala
All posts