DEV Community

Pietrangelo Masala
Pietrangelo Masala

Posted on

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"
    }
}
Enter fullscreen mode Exit fullscreen mode

Which results in the following layout:

Zellij with Helix editor

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
Enter fullscreen mode Exit fullscreen mode

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'
Enter fullscreen mode Exit fullscreen mode

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

Top comments (2)

Collapse
 
nuke profile image
Nuke

This is a great staring place - thank you!! Excited to see what Alacritty + Zellij + Helix can do together ✨

Collapse
 
kankys profile image
Lukáš Kaňka

Thanks a lot, Helix is great and with this fact is even better.