From a5f4745bf8e12e814cb95a819c63d6a533c926ad Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 16 Oct 2024 21:47:40 +0200 Subject: [PATCH] do the correct zsh and zellij magics --- home-manager/shared/default.nix | 2 + home-manager/shared/shell/helix/default.nix | 7 ++ home-manager/shared/shell/zellij/default.nix | 89 ++++++++++++++++++++ home-manager/shared/shell/zsh.nix | 1 + 4 files changed, 99 insertions(+) diff --git a/home-manager/shared/default.nix b/home-manager/shared/default.nix index 4a6ced0..9841353 100644 --- a/home-manager/shared/default.nix +++ b/home-manager/shared/default.nix @@ -31,5 +31,7 @@ zsh bat btop + broot + lazygit ]; } diff --git a/home-manager/shared/shell/helix/default.nix b/home-manager/shared/shell/helix/default.nix index ab4b3f3..0362579 100644 --- a/home-manager/shared/shell/helix/default.nix +++ b/home-manager/shared/shell/helix/default.nix @@ -10,6 +10,13 @@ settings = { # theme = "catppuccin_macchiato"; # Don't need this because the module themes it for us + keys.normal.backspace = { + b = ":run-shell-command zellij run -f -- just build"; + r = ":run-shell-command zellij run -f -- just run"; + t = ":run-shell-command zellij run -f -- just test"; + g = ":run-shell-command zellij run -fc -- lazygit"; + f = ":run-shell-command zellij run -fc -- broot"; + }; editor = { line-number = "relative"; lsp.display-messages = true; diff --git a/home-manager/shared/shell/zellij/default.nix b/home-manager/shared/shell/zellij/default.nix index 36b811f..1565979 100644 --- a/home-manager/shared/shell/zellij/default.nix +++ b/home-manager/shared/shell/zellij/default.nix @@ -54,6 +54,89 @@ } } + default_tab_template { + pane size=1 borderless=true { + plugin location="file:${inputs.zjstatus.packages.${pkgs.system}.default}/bin/zjstatus.wasm" { + format_left "#[bg=#1D1D2E,fg=#C9D2F5,bold] {session} {mode} {tabs}" + format_right "#[bg=#C9D2F5,fg=#1D1D2E]#[bg=#C9D2F5,fg=#C9D2F5]#[bg=#C9D2F5,fg=#1D1D2E,bold]{datetime}#[bg=#1D1D2E,fg=#C9D2F5]" + + mode_locked "#[fg=magenta,bold] {name} " + mode_normal "#[fg=green,bold] {name} " + mode_resize "#[fg=orange,bold] {name} " + mode_default_to_mode "resize" + + tab_normal "#[bg=#C9D2F5,fg=#1D1D2E]#[bg=#C9D2F5,fg=#C9D2F5]#[bg=#C9D2F5,fg=#1D1D2E,bold]{name}{sync_indicator}{fullscreen_indicator}{floating_indicator}#[bg=#C9D2F5,fg=#C9D2F5]#[bg=#1D1D2E,fg=#C9D2F5]" + tab_active "#[bg=#A6DA95,fg=#1D1D2E]#[bg=#A6DA95,fg=#A6DA95]#[bg=#A6DA95,fg=#1D1D2E,bold]{name}{sync_indicator}{fullscreen_indicator}{floating_indicator}#[bg=#A6DA95,fg=#A6DA95]#[bg=#1D1D2E,fg=#A6DA95]" + + tab_sync_indicator " " + tab_fullscreen_indicator "□ " + tab_floating_indicator "󰉈 " + + datetime "#[bg=#C9D2F5,fg=#1D1D2E,bold]{format} " + datetime_format "%Y-%m-%d %H:%M" + datetime_timezone "Europe/Amsterdam" + } + } + children + pane size=2 borderless=true { + plugin location="status-bar" + } + } + } + ''; + helix_zellij = + pkgs.writeText "helix.kdl" + '' + layout { + tab { + pane { + command "hx" + args "." + } + pane split_direction="vertical" size="20%" {} + } + swap_tiled_layout name="vertical" { + tab max_panes=5 { + pane split_direction="vertical" { + pane + pane { children; } + } + } + tab max_panes=8 { + pane split_direction="vertical" { + pane { children; } + pane { pane; pane; pane; pane; } + } + } + tab max_panes=12 { + pane split_direction="vertical" { + pane { children; } + pane { pane; pane; pane; pane; } + pane { pane; pane; pane; pane; } + } + } + } + + swap_tiled_layout name="horizontal" { + tab max_panes=5 { + pane + pane + } + tab max_panes=8 { + pane { + pane split_direction="vertical" { children; } + pane split_direction="vertical" { pane; pane; pane; pane; } + } + } + tab max_panes=12 { + pane { + pane split_direction="vertical" { children; } + pane split_direction="vertical" { pane; pane; pane; pane; } + pane split_direction="vertical" { pane; pane; pane; pane; } + } + } + } + default_tab_template { pane size=1 borderless=true { plugin location="file:${inputs.zjstatus.packages.${pkgs.system}.default}/bin/zjstatus.wasm" { @@ -131,6 +214,12 @@ in { target = ".config/zellij/layouts/default.kdl"; }; }; + home.file = { + "helix_zellij" = { + source = "${helix_zellij}"; + target = ".config/zellij/layouts/helix.kdl"; + }; + }; #home.file = { # "config" = { # source = ./zellij.kdl; diff --git a/home-manager/shared/shell/zsh.nix b/home-manager/shared/shell/zsh.nix index cc38d8f..55878f2 100644 --- a/home-manager/shared/shell/zsh.nix +++ b/home-manager/shared/shell/zsh.nix @@ -71,6 +71,7 @@ initExtra = '' eval "$(zoxide init --cmd cd zsh)" tre() { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; } + zhx() { command zellij action new-tab --layout $HOME/.config/zellij/layouts/helix.kdl; } ''; }; }