Configure Zellij terminal multiplexer with layouts, themes, keybindings, and behavior settings using KDL format.
Configure Zellij terminal multiplexer following best practices and XDG Base Directory specification.
Zellij uses KDL (KDL Document Language) format and follows XDG spec:
~/.config/zellij/config.kdl~/.config/zellij/themes/~/.config/zellij/layouts/Determine what the user wants to configure:
For new setup:
# Generate default config
mkdir -p ~/.config/zellij
zellij setup --dump-config > ~/.config/zellij/config.kdl
# Check config directory location
zellij setup --check
Basic structure:
// Mouse support
mouse_mode true
// Pane frames
pane_frames true
// Copy on selection
copy_on_select true
// Scrollback
scroll_buffer_size 10000
// Default shell
default_shell "fish"
// Default layout
default_layout "compact"
// Default theme
theme "catppuccin-mocha"
// UI configuration
simplified_ui false
default_mode "normal"
// Session serialization
session_serialization true
// Clipboard provider
copy_command "pbcopy" // macOS
// copy_command "xclip -selection clipboard" // Linux X11
// copy_command "wl-copy" // Linux Wayland
Important settings:
mouse_mode: Enable/disable mouse supportpane_frames: Show borders around panescopy_on_select: Auto-copy selected textscroll_buffer_size: Lines of scrollback historydefault_shell: Shell to launch in new panessession_serialization: Save/restore sessions on exitmirror_session: Allow session mirroringBasic layout structure:
layout {
// Single pane
pane
// Vertical split with two panes
pane split_direction="vertical" {
pane
pane
}
}
Common layout patterns:
Development layout (code + terminal):
layout {
default_tab_template {
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
children
pane size=2 borderless=true {
plugin location="zellij:status-bar"
}
}
tab name="dev" {
pane split_direction="vertical" {
pane size="70%" {
// Editor pane
}
pane split_direction="horizontal" {
pane {
// Terminal for commands
}
pane {
// Logs or tests
}
}
}
}
}
Multi-tab workspace:
layout {
tab name="editor" focus=true {
pane
}
tab name="servers" {
pane split_direction="vertical" {
pane command="npm" {
args "run" "dev"
}
pane command="docker" {
args "compose" "logs" "-f"
}
}
}
tab name="monitoring" {
pane command="htop"
pane command="btop"
}
}
Pane properties:
split_direction: "vertical" or "horizontal"size: Percentage ("70%") or fixedcommand: Executable to runargs: Command arguments (space-separated strings)cwd: Working directoryfocus: Boolean for initial focusborderless: Hide pane bordersname: Pane titleLayout best practices:
default_tab_template for consistent tab structureTheme structure:
themes {
custom_theme {
fg "#cdd6f4"
bg "#1e1e2e"
black "#45475a"
red "#f38ba8"
green "#a6e3a1"
yellow "#f9e2af"
blue "#89b4fa"
magenta "#f5c2e7"
cyan "#94e2d5"
white "#bac2de"
orange "#fab387"
}
}
Color properties (all RGB or hex):
fg: Foreground textbg: Backgroundblack, red, green, yellow, blue, magenta, cyan, white: ANSI colorsorange: Additional accent colorUI component theming:
themes {
detailed_theme {
// Base colors
fg "#cdd6f4"
bg "#1e1e2e"
// ANSI colors
black "#45475a"
red "#f38ba8"
green "#a6e3a1"
yellow "#f9e2af"
blue "#89b4fa"
magenta "#f5c2e7"
cyan "#94e2d5"
white "#bac2de"
orange "#fab387"
// Frame colors
text_unselected {
base 255 255 255
background 30 30 46
}
text_selected {
base 49 50 68
background 205 214 244
}
ribbon_unselected {
base 255 255 255
background 88 91 112
}
ribbon_selected {
base 49 50 68
background 137 180 250
}
frame_unselected {
base 88 91 112
background 30 30 46
}
frame_selected {
base 137 180 250
background 30 30 46
}
}
}
Built-in themes to reference:
catppuccin-mocha, catppuccin-lattedraculagruvbox-dark, gruvbox-lightnordtokyo-night, tokyo-night-stormApply theme:
// In config.kdl
theme "custom_theme"
Or via command line:
zellij options --theme custom_theme
Keybinding structure:
keybinds {
normal {
bind "Ctrl g" { SwitchToMode "locked"; }
bind "Ctrl p" { SwitchToMode "pane"; }
bind "Ctrl t" { SwitchToMode "tab"; }
bind "Ctrl n" { SwitchToMode "resize"; }
bind "Ctrl h" { MoveFocus "Left"; }
bind "Ctrl l" { MoveFocus "Right"; }
bind "Ctrl j" { MoveFocus "Down"; }
bind "Ctrl k" { MoveFocus "Up"; }
}
pane {
bind "Ctrl p" { SwitchToMode "normal"; }
bind "h" { MoveFocus "Left"; }
bind "l" { MoveFocus "Right"; }
bind "j" { MoveFocus "Down"; }
bind "k" { MoveFocus "Up"; }
bind "n" { NewPane; SwitchToMode "normal"; }
bind "d" { NewPane "Down"; SwitchToMode "normal"; }
bind "r" { NewPane "Right"; SwitchToMode "normal"; }
bind "x" { CloseFocus; SwitchToMode "normal"; }
bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; }
}
tab {
bind "Ctrl t" { SwitchToMode "normal"; }
bind "n" { NewTab; SwitchToMode "normal"; }
bind "x" { CloseTab; SwitchToMode "normal"; }
bind "r" { SwitchToMode "renametab"; }
bind "h" { GoToPreviousTab; }
bind "l" { GoToNextTab; }
bind "1" { GoToTab 1; SwitchToMode "normal"; }
bind "2" { GoToTab 2; SwitchToMode "normal"; }
bind "3" { GoToTab 3; SwitchToMode "normal"; }
}
resize {
bind "Ctrl n" { SwitchToMode "normal"; }
bind "h" { Resize "Left"; }
bind "j" { Resize "Down"; }
bind "k" { Resize "Up"; }
bind "l" { Resize "Right"; }
bind "=" { Resize "Increase"; }
bind "-" { Resize "Decrease"; }
}
locked {
bind "Ctrl g" { SwitchToMode "normal"; }
}
}
Available modes:
normal: Default modepane: Pane managementtab: Tab managementresize: Pane resizingmove: Moving panesscroll: Scrollback navigationlocked: Input pass-through (all keys go to terminal)renametab, renamepane: Renaming modessession: Session managementCommon actions:
SwitchToMode "mode": Change modeMoveFocus "direction": Focus navigation (Left/Right/Up/Down)NewPane, NewPane "direction": Create paneCloseFocus: Close focused paneNewTab, CloseTab: Tab managementGoToTab N: Jump to tab numberGoToPreviousTab, GoToNextTab: Tab navigationResize "direction": Resize panesToggleFocusFullscreen: Maximize/restore paneTogglePaneFrames: Show/hide bordersQuit: Exit ZellijKey syntax:
"Ctrl x": Control + key"Alt x": Alt + key"Ctrl Alt x": Multiple modifiers"F1" through "F12": Function keys"Space", "Enter", "Tab", "Esc": Special keysbind "x" "X" { Action; }Read existing config (if present):
Read ~/.config/zellij/config.kdl
For new configs, generate base:
zellij setup --dump-config > ~/.config/zellij/config.kdl
Apply changes using Edit or Write:
Validate KDL syntax:
{}//Test changes:
zellij setup --check to verify paths// Mouse and UI
mouse_mode true
pane_frames true
simplified_ui false
// Behavior
copy_on_select true
scroll_buffer_size 10000
session_serialization true
// Shell and theme
default_shell "fish"
theme "catppuccin-mocha"
// Clipboard (macOS)
copy_command "pbcopy"
keybinds {
normal {
bind "Ctrl h" { MoveFocus "Left"; }
bind "Ctrl j" { MoveFocus "Down"; }
bind "Ctrl k" { MoveFocus "Up"; }
bind "Ctrl l" { MoveFocus "Right"; }
bind "Ctrl n" { NewPane; }
bind "Ctrl x" { CloseFocus; }
}
}
layout {
tab name="dev" {
pane split_direction="vertical" {
pane size="60%"
pane split_direction="horizontal" {
pane command="npm" {
args "run" "dev"
}
pane
}
}
}
}
Since this is a dotfiles repo following XDG spec:
config/zellij/config.kdlconfig/zellij/layouts/*.kdlconfig/zellij/themes/*.kdlln -sf ~/Development/dotfiles/config/zellij ~/.config/zellij
When configuring Zellij:
file:line formatThis dotfiles repo:
flake.nix)config/** to ~/.config/For comprehensive options, reference:
Useful commands:
# Check config paths
zellij setup --check
# Generate default config
zellij setup --dump-config
# List available actions
zellij action --help