login

Zellij: Config & Layout

My config and layout files for the Zellij terminal multiplexer.

2023-12-03


I aliased the zellij command with mx (which stands for multiplexer) and also provide my custom layout config file.

Add the following alias to the ~/.bashrc file:

alias mx="zellij --layout $HOME/.config/zellij/layout.kdl"

Config

I remapped the mode keybindings to the locked mode to minimize interference with other applications (such as the Helix Editor). If I want to enter into session mode for example, I hit Ctrl + g to enter locked mode and press o for session mode.

NOTE: In locked mode the Ctrl can be omitted if you switch into another mode.

The config file ~/.config/zellij/config.kdl:

simplified_ui true
pane_frames false
default_layout "compact"

ui {
    pane_frames {
        rounded_corners true
    }
}

keybinds {
    normal {
        unbind "Ctrl p"
        unbind "Ctrl t"
        unbind "Ctrl n"
        unbind "Ctrl h"
        unbind "Ctrl s"
        unbind "Ctrl o"
        unbind "Ctrl q"
    }
    locked {
        unbind "Ctrl g"
        bind "Esc" { SwitchToMode "Normal"; }
        bind "p" { SwitchToMode "Pane"; }
        bind "t" { SwitchToMode "Tab"; }
        bind "n" { SwitchToMode "Resize"; }
        bind "h" { SwitchToMode "Move"; }
        bind "s" { SwitchToMode "Search"; }
        bind "o" { SwitchToMode "Session"; }
    }
    resize {
        unbind "Ctrl n"
    }
    pane {
        unbind "Ctrl p"
    }
    move {
        unbind "Ctrl h"
    }
    tab {
        unbind "Ctrl t"
    }
    search {
        unbind "Ctrl s"
    }
    session {
        unbind "Ctrl o"
    }
}

Layout

I use the plugin zjstatus which allows me to configure the statusbar to my needs.

The config file ~/.config/zellij/layout.kdl:

layout {
    pane split_direction="vertical" {
        pane
    }
    pane size=1 borderless=true {
        plugin location="file:~/.config/zellij/plugins/zjstatus.wasm" {
            format_left "{mode} #[fg=blue,bold]{session} {tabs}"
            format_right "{datetime}"
            format_space ""

            hide_frame_for_single_pane "false"

            mode_normal " NOR "
            mode_locked " LOC "
            mode_tab " TAB "
            mode_pane " PAN "
            mode_scroll " SCR "
            mode_resize " RES "
            mode_session " SEO "

            tab_normal "#[bg=#222222,fg=#AAAAAA] {name} "
            tab_active "#[bg=#444444,fg=#FFFFFF,bold] {name} "

            datetime "#[fg=#6C7086,bold] {format} "
            datetime_format "%%a, %%d %%b %%Y  %%H:%%M"
            datetime_timezone "Europe/Berlin"
        }
    }
}