From b5a3bda4a028756b2e47e49feeec40fea9a86887 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Sat, 2 Nov 2024 08:06:48 +0300 Subject: [PATCH] Yazi: Never enging theming.j --- home/config/yazi/module/Keymap.nix | 60 +++++++++++++++++------------- home/config/yazi/module/Theme.nix | 37 +++++++++++++----- home/config/yazi/module/Yazi.nix | 1 + 3 files changed, 64 insertions(+), 34 deletions(-) diff --git a/home/config/yazi/module/Keymap.nix b/home/config/yazi/module/Keymap.nix index 9786664b..ecd09c03 100644 --- a/home/config/yazi/module/Keymap.nix +++ b/home/config/yazi/module/Keymap.nix @@ -1,33 +1,43 @@ { pkgs, ... }: +let + mkKeymap = desc: on: run: { inherit desc on run; }; +in { + # REF: https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/keymap.toml file = (pkgs.formats.toml { }).generate "YaziKeymapConfig" { manager = { prepend_keymap = [ - { - desc = "Dangerous life"; - on = "d"; - run = "remove --permanently"; - } - { - desc = "Dangerous life"; - on = "D"; - run = "remove --permanently --force"; - } - { - desc = "Spawn shell here"; - on = ""; - run = ''shell "SHELL_NAME=yazi $SHELL" --block --confirm''; - } - { - desc = "Open interactively"; - on = "o"; - run = "open --interactive"; - } - { - desc = "Open default"; - on = "O"; - run = "open"; - } + (mkKeymap "Delete" "d" "remove --permanently") + (mkKeymap "Delete no questions asked" "D" "remove --permanently --force") + (mkKeymap "Spawn shell here" "" ''shell "SHELL_NAME=yazi $SHELL" --block --confirm'') + (mkKeymap "Open interactively" "o" "open --interactive") + (mkKeymap "Open default" "O" "open") + # I wanna die thanks to nixfmt. + (mkKeymap "Go to storage" [ + "g" + "s" + ] "cd /storage") + (mkKeymap "Go to tmp" [ + "g" + "t" + ] "cd ~/tmp") + (mkKeymap "Go to system tmp" [ + "g" + "T" + ] "cd /tmp") + (mkKeymap "Go to projects" [ + "g" + "p" + ] "cd ~/project") + # Yazi devs are... special. + (mkKeymap "Go to downloads" [ + "g" + "d" + ] "cd $XDG_DOWNLOAD_DIR") + (mkKeymap "Go to configs" [ + "g" + "c" + ] "cd $XDG_CONFIG_HOME") ]; }; }; diff --git a/home/config/yazi/module/Theme.nix b/home/config/yazi/module/Theme.nix index b562f74e..45047601 100644 --- a/home/config/yazi/module/Theme.nix +++ b/home/config/yazi/module/Theme.nix @@ -1,5 +1,6 @@ { pkgs, config, ... }: let + color = config.style.color; border = { fg = "#${config.style.color.border}"; }; @@ -19,15 +20,30 @@ let }; in { + # REF: https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/theme.toml file = (pkgs.formats.toml { }).generate "YaziThemeConfig" { - manager = { - border_style = border; - border_symbol = " "; - cwd = text; - hovered = hover; - preview_hovered = hover; - tab_active = hover; - }; + manager = + let + mkMarker = color: { + bg = "#${color}"; + fg = "#${color}"; + }; + in + { + border_style = border; + border_symbol = " "; + count_copied = hover; + count_cut = hover; + count_selected = hover; + cwd = text; + hovered = hover; + marker_copied = mkMarker color.accent; + marker_cut = mkMarker color.accent; + marker_marked = mkMarker color.hl; + marker_selected = mkMarker color.selection; + preview_hovered = hover; + tab_active = hover; + }; select = { border = borderLight; }; @@ -51,7 +67,10 @@ in separator = " - "; separator_style = text; }; - + confirm = { + border = borderLight; + title = borderLight; + }; status = { mode_normal = hover; mode_select = select; diff --git a/home/config/yazi/module/Yazi.nix b/home/config/yazi/module/Yazi.nix index 27804a77..c4e263f0 100644 --- a/home/config/yazi/module/Yazi.nix +++ b/home/config/yazi/module/Yazi.nix @@ -1,5 +1,6 @@ { pkgs, config, ... }: { + # REF: https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/yazi.toml file = (pkgs.formats.toml { }).generate "YaziYaziConfig" { manager = { # linemode = "mtime";