Updated zellij config

This commit is contained in:
2026-04-11 14:19:46 -04:00
parent 1b9dbdd1c3
commit 0b5824120b

View File

@@ -1,8 +1,35 @@
{ {
flake.modules.homeManager.zellij = { inputs,
...
}:
{
flake.modules.homeManager.zellij =
{ pkgs, ... }:
{
programs.zellij = programs.zellij =
let let
mod = "Alt"; # Can be one of "Ctrl", "Alt", "Shift", "Super" mod = "Alt"; # Can be one of "Ctrl", "Alt", "Shift", "Super"
action = name: { ${name} = { }; };
actionWith = name: args: { ${name}._args = args; };
switchMode = mode: actionWith "SwitchToMode" [ mode ];
bind =
{ keys, actions }:
{
bind = {
_args = [ keys ];
_children = actions;
};
};
modeBinds = mode: bindings: {
${mode}._children = map bind bindings;
};
sharedExcept = modes: bindings: {
shared_except = {
_args = modes;
_children = map bind bindings;
};
};
in in
{ {
enable = true; enable = true;
@@ -10,434 +37,271 @@
settings = { settings = {
theme = "catppuccin-mocha"; theme = "catppuccin-mocha";
show_startup_tips = false; show_startup_tips = false;
default_mode = "locked";
ui._children = [
{
pane_frames._children = [
{ rounded_corners = true; }
];
}
];
keybinds = { keybinds = {
_props = { _props = {
clear-defaults = true; clear-defaults = true;
}; };
_children = [ _children = [
(modeBinds "locked" [
{ {
locked._children = [ keys = "${mod} q";
{ actions = [
bind = { (switchMode "Normal")
_args = [ "${mod} g" ]; ];
_children = [ { SwitchToMode._args = [ "Normal" ]; } ];
};
} }
])
(sharedExcept
[ "locked" "normal" "renamepane" "renametab" ]
[
{
keys = "Esc";
actions = [ (switchMode "Normal") ];
}
]
)
(modeBinds "normal" [
{
keys = "Esc";
actions = [ (switchMode "Locked") ];
}
{
keys = "h";
actions = [ (actionWith "MoveFocusOrTab" [ "Left" ]) ];
}
{
keys = "j";
actions = [ (actionWith "MoveFocus" [ "Down" ]) ];
}
{
keys = "k";
actions = [ (actionWith "MoveFocus" [ "Up" ]) ];
}
{
keys = "l";
actions = [ (actionWith "MoveFocusOrTab" [ "Right" ]) ];
}
{
keys = "H";
actions = [ (action "GoToPreviousTab") ];
}
{
keys = "L";
actions = [ (action "GoToNextTab") ];
}
{
keys = "p";
actions = [ (switchMode "Pane") ];
}
{
keys = "t";
actions = [ (switchMode "Tab") ];
}
{
keys = "r";
actions = [ (switchMode "Resize") ];
}
])
(modeBinds "pane" [
{
keys = "h";
actions = [ (actionWith "MovePane" [ "Left" ]) ];
}
{
keys = "j";
actions = [ (actionWith "MovePane" [ "Down" ]) ];
}
{
keys = "k";
actions = [ (actionWith "MovePane" [ "Up" ]) ];
}
{
keys = "l";
actions = [ (actionWith "MovePane" [ "Right" ]) ];
}
{
keys = "s";
actions = [
(actionWith "NewPane" [ "stacked" ])
]; ];
} }
{ {
resize._children = [ keys = "d";
{ actions = [
bind = { (actionWith "NewPane" [ "down" ])
_args = [ "${mod} r" ];
_children = [ { SwitchToMode._args = [ "Normal" ]; } ];
};
}
{
bind = {
_args = [ "h" ];
_children = [ { Resize._args = [ "Increase Left" ]; } ];
};
}
{
bind = {
_args = [ "j" ];
_children = [ { Resize._args = [ "Increase Down" ]; } ];
};
}
{
bind = {
_args = [ "k" ];
_children = [ { Resize._args = [ "Increase Up" ]; } ];
};
}
{
bind = {
_args = [ "l" ];
_children = [ { Resize._args = [ "Increase Right" ]; } ];
};
}
];
}
{
pane._children = [
{
bind = {
_args = [ "${mod} p" ];
_children = [ { SwitchToMode._args = [ "Normal" ]; } ];
};
}
{
bind = {
_args = [ "c" ];
_children = [ { Clear = { }; } ];
};
}
{
bind = {
_args = [ "e" ];
_children = [
{ TogglePaneEmbedOrFloating = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "f" ];
_children = [
{ ToggleFocusFullscreen = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "s" ];
_children = [
{ NewPane._args = [ "stacked" ]; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "j" ];
_children = [
{ NewPane._args = [ "Down" ]; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "l" ];
_children = [
{ NewPane._args = [ "Right" ]; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "n" ];
_children = [
{ NewPane = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "p" ];
_children = [
{ SwitchFocus = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "r" ];
_children = [
{ SwitchToMode._args = [ "RenamePane" ]; }
{ PaneNameInput._args = [ 0 ]; }
];
};
}
{
bind = {
_args = [ "w" ];
_children = [
{ ToggleFloatingPanes = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "x" ];
_children = [
{ CloseFocus = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "z" ];
_children = [
{ TogglePaneFrames = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
]; ];
} }
{ {
move._children = [ keys = "r";
{ actions = [
bind = { (actionWith "NewPane" [ "right" ])
_args = [ "${mod} m" ];
_children = [ { SwitchToMode._args = [ "Normal" ]; } ];
};
}
{
bind = {
_args = [ "h" ];
_children = [ { MovePane._args = [ "Left" ]; } ];
};
}
{
bind = {
_args = [ "j" ];
_children = [ { MovePane._args = [ "Down" ]; } ];
};
}
{
bind = {
_args = [ "k" ];
_children = [ { MovePane._args = [ "Up" ]; } ];
};
}
{
bind = {
_args = [ "l" ];
_children = [ { MovePane._args = [ "Right" ]; } ];
};
}
]; ];
} }
{ {
tab._children = [ keys = "x";
{ actions = [
bind = { (action "CloseFocus")
_args = [ "${mod} t" ];
_children = [ { SwitchToMode._args = [ "Normal" ]; } ];
};
}
{
bind = {
_args = [ "b" ];
_children = [
{ BreakPane = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "h" ];
_children = [ { MoveTab._args = [ "Left" ]; } ];
};
}
{
bind = {
_args = [ "l" ];
_children = [ { MoveTab._args = [ "Right" ]; } ];
};
}
{
bind = {
_args = [ "n" ];
_children = [
{ NewTab = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
{
bind = {
_args = [ "r" ];
_children = [
{ SwitchToMode._args = [ "RenameTab" ]; }
{ TabNameInput._args = [ 0 ]; }
];
};
}
{
bind = {
_args = [ "x" ];
_children = [
{ CloseTab = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
]; ];
} }
{ {
renametab._children = [ keys = "e";
{ actions = [
bind = { (action "TogglePaneEmbedOrFloating")
_args = [ "${mod} c" ];
_children = [ { SwitchToMode._args = [ "Normal" ]; } ];
};
}
{
bind = {
_args = [ "Esc" ];
_children = [
{ UndoRenameTab = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
]; ];
} }
{ {
renamepane._children = [ keys = "f";
{ actions = [
bind = { (action "ToggleFocusFullscreen")
_args = [ "${mod} c" ];
_children = [ { SwitchToMode._args = [ "Normal" ]; } ];
};
}
{
bind = {
_args = [ "Esc" ];
_children = [
{ UndoRenamePane = { }; }
{ SwitchToMode._args = [ "Normal" ]; }
];
};
}
]; ];
} }
{ {
shared_except = { keys = "c";
_args = [ "locked" ]; actions = [
_children = [ (switchMode "RenamePane")
{ (actionWith "PaneNameInput" [ 0 ])
bind = {
_args = [ "${mod} g" ];
_children = [ { SwitchToMode._args = [ "Locked" ]; } ];
};
}
{
bind = {
_args = [ "${mod} h" ];
_children = [ { MoveFocusOrTab._args = [ "Left" ]; } ];
};
}
{
bind = {
_args = [ "${mod} l" ];
_children = [ { MoveFocusOrTab._args = [ "Right" ]; } ];
};
}
{
bind = {
_args = [ "${mod} j" ];
_children = [ { MoveFocus._args = [ "Down" ]; } ];
};
}
{
bind = {
_args = [ "${mod} k" ];
_children = [ { MoveFocus._args = [ "Up" ]; } ];
};
}
{
bind = {
_args = [ "${mod} [" ];
_children = [ { PreviousSwapLayout = { }; } ];
};
}
{
bind = {
_args = [ "${mod} ]" ];
_children = [ { NextSwapLayout = { }; } ];
};
}
]; ];
};
} }
{ {
shared_except = { keys = "w";
_args = [ actions = [
"normal" (action "ToggleFloatingPanes")
"locked"
]; ];
_children = [
{
bind = {
_args = [
"Enter"
"Esc"
];
_children = [ { SwitchToMode = [ "Normal" ]; } ];
};
}
];
};
} }
{ {
shared_except = { keys = "[";
_args = [ actions = [
"pane" (action "BreakPaneLeft")
"locked"
]; ];
_children = [
{
bind = {
_args = [ "${mod} p" ];
_children = [ { SwitchToMode = [ "Pane" ]; } ];
};
}
];
};
} }
{ {
shared_except = { keys = "]";
_args = [ actions = [
"resize" (action "BreakPaneRight")
"locked"
]; ];
_children = [
{
bind = {
_args = [ "${mod} r" ];
_children = [ { SwitchToMode = [ "Resize" ]; } ];
};
} }
]; ])
}; (modeBinds "tab" [
{
keys = "h";
actions = [ (actionWith "MoveTab" [ "Left" ]) ];
} }
{ {
shared_except = { keys = "l";
_args = [ actions = [ (actionWith "MoveTab" [ "Right" ]) ];
"tab"
"locked"
];
_children = [
{
bind = {
_args = [ "${mod} t" ];
_children = [ { SwitchToMode = [ "Tab" ]; } ];
};
}
];
};
} }
{ {
shared_except = { keys = "b";
_args = [ actions = [
"move" (action "BreakPane")
"locked"
]; ];
_children = [ }
{ {
bind = { keys = "x";
_args = [ "${mod} m" ]; actions = [
_children = [ { SwitchToMode = [ "Move" ]; } ]; (action "CloseTab")
};
}
]; ];
};
} }
{
keys = "n";
actions = [
(action "NewTab")
];
}
{
keys = "c";
actions = [
(switchMode "RenameTab")
(actionWith "TabNameInput" [ 0 ])
];
}
])
(modeBinds "renamepane" [
{
keys = "Enter";
actions = [
(switchMode "Pane")
];
}
{
keys = "Esc";
actions = [
(action "UndoRenamePane")
(switchMode "Pane")
];
}
])
(modeBinds "renametab" [
{
keys = "Enter";
actions = [
(switchMode "Tab")
];
}
{
keys = "Esc";
actions = [
(action "UndoRenameTab")
(switchMode "Tab")
];
}
])
(modeBinds "resize" [
{
keys = "h";
actions = [ (actionWith "Resize" [ "Increase Left" ]) ];
}
{
keys = "j";
actions = [ (actionWith "Resize" [ "Increase Down" ]) ];
}
{
keys = "k";
actions = [ (actionWith "Resize" [ "Increase Up" ]) ];
}
{
keys = "l";
actions = [ (actionWith "Resize" [ "Increase Right" ]) ];
}
{
keys = "H";
actions = [ (actionWith "Resize" [ "Decrease Right" ]) ];
}
{
keys = "J";
actions = [ (actionWith "Resize" [ "Decrease Up" ]) ];
}
{
keys = "K";
actions = [ (actionWith "Resize" [ "Decrease Down" ]) ];
}
{
keys = "L";
actions = [ (actionWith "Resize" [ "Decrease Left" ]) ];
}
{
keys = "+";
actions = [ (actionWith "Resize" [ "Increase" ]) ];
}
{
keys = "=";
actions = [ (actionWith "Resize" [ "Increase" ]) ];
}
{
keys = "-";
actions = [ (actionWith "Resize" [ "Decrease" ]) ];
}
])
]; ];
}; };
@@ -449,10 +313,72 @@
}; };
}; };
simplified_ui = true; # simplified_ui = true;
pane_frames = false; # pane_frames = true;
copy_on_select = true; copy_on_select = true;
}; };
}; };
xdg.configFile."zellij/layouts/default.kdl".text =
let
zjstatus = inputs.zjstatus.packages.${pkgs.stdenv.hostPlatform.system}.default;
in
''
layout {
default_tab_template {
pane size=2 borderless=true {
plugin location="file:${zjstatus}/bin/zjstatus.wasm" {
hide_frame_except_for_search "true"
border_enabled "true"
border_char ""
border_format "#[fg=#6C7086]{char}"
border_position "bottom"
format_left " {mode} #[fg=#6c7086] #[fg=#eba0ac] {session}"
format_center "{tabs}"
format_right ""
format_space ""
format_hide_on_overlength "true"
format_precedence "crl"
tab_normal "#[fg=#f5e0dc] {name}{fullscreen_indicator}{sync_indicator}{floating_indicator} "
tab_active "#[fg=#1e1e2e,bg=#fab387] {name}{fullscreen_indicator}{sync_indicator}{floating_indicator} "
tab_fullscreen_indicator " "
tab_sync_indicator " "
tab_floating_indicator " 󰉈"
tab_separator "#[fg=#6C7086] "
mode_normal "#[fg=#a6da95]NORMAL"
mode_locked "#[fg=#6e738d]LOCKED "
mode_resize "#[fg=#f38ba8]RESIZE"
mode_pane "#[fg=#89b4fa]PANE"
mode_tab "#[fg=#b4befe]TAB"
mode_scroll "#[fg=#f9e2af]SCROLL"
mode_enter_search "#[fg=#8aadf4]ENT-SEARCH"
mode_search "#[fg=#8aadf4]SEARCHARCH"
mode_rename_tab "#[fg=#b4befe]RENAME-TAB"
mode_rename_pane "#[fg=#89b4fa]RENAME-PANE"
mode_session "#[fg=#74c7ec]SESSION"
mode_move "#[fg=#f5c2e7]MOVE"
mode_prompt "#[fg=#8aadf4]PROMPT"
mode_tmux "#[fg=#f5a97f]TMUX"
command_host_command "uname -n"
command_host_format "{stdout}"
command_host_interval "0"
command_host_rendermode "static"
command_user_command "whoami"
command_user_format "{stdout}"
command_user_interval "0"
command_user_rendermode "static"
}
}
children
}
}
'';
}; };
} }