Yazi: Never enging theming.j

This commit is contained in:
Dmitry Voronin 2024-11-02 08:06:48 +03:00
parent 9a433f44dc
commit b5a3bda4a0
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
3 changed files with 64 additions and 34 deletions

View file

@ -1,33 +1,43 @@
{ pkgs, ... }: { 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" { file = (pkgs.formats.toml { }).generate "YaziKeymapConfig" {
manager = { manager = {
prepend_keymap = [ prepend_keymap = [
{ (mkKeymap "Delete" "d" "remove --permanently")
desc = "Dangerous life"; (mkKeymap "Delete no questions asked" "D" "remove --permanently --force")
on = "d"; (mkKeymap "Spawn shell here" "<Enter>" ''shell "SHELL_NAME=yazi $SHELL" --block --confirm'')
run = "remove --permanently"; (mkKeymap "Open interactively" "o" "open --interactive")
} (mkKeymap "Open default" "O" "open")
{ # I wanna die thanks to nixfmt.
desc = "Dangerous life"; (mkKeymap "Go to storage" [
on = "D"; "g"
run = "remove --permanently --force"; "s"
} ] "cd /storage")
{ (mkKeymap "Go to tmp" [
desc = "Spawn shell here"; "g"
on = "<Enter>"; "t"
run = ''shell "SHELL_NAME=yazi $SHELL" --block --confirm''; ] "cd ~/tmp")
} (mkKeymap "Go to system tmp" [
{ "g"
desc = "Open interactively"; "T"
on = "o"; ] "cd /tmp")
run = "open --interactive"; (mkKeymap "Go to projects" [
} "g"
{ "p"
desc = "Open default"; ] "cd ~/project")
on = "O"; # Yazi devs are... special.
run = "open"; (mkKeymap "Go to downloads" [
} "g"
"d"
] "cd $XDG_DOWNLOAD_DIR")
(mkKeymap "Go to configs" [
"g"
"c"
] "cd $XDG_CONFIG_HOME")
]; ];
}; };
}; };

View file

@ -1,5 +1,6 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let let
color = config.style.color;
border = { border = {
fg = "#${config.style.color.border}"; fg = "#${config.style.color.border}";
}; };
@ -19,12 +20,27 @@ let
}; };
in in
{ {
# REF: https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/theme.toml
file = (pkgs.formats.toml { }).generate "YaziThemeConfig" { file = (pkgs.formats.toml { }).generate "YaziThemeConfig" {
manager = { manager =
let
mkMarker = color: {
bg = "#${color}";
fg = "#${color}";
};
in
{
border_style = border; border_style = border;
border_symbol = " "; border_symbol = " ";
count_copied = hover;
count_cut = hover;
count_selected = hover;
cwd = text; cwd = text;
hovered = hover; 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; preview_hovered = hover;
tab_active = hover; tab_active = hover;
}; };
@ -51,7 +67,10 @@ in
separator = " - "; separator = " - ";
separator_style = text; separator_style = text;
}; };
confirm = {
border = borderLight;
title = borderLight;
};
status = { status = {
mode_normal = hover; mode_normal = hover;
mode_select = select; mode_select = select;

View file

@ -1,5 +1,6 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
# REF: https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/yazi.toml
file = (pkgs.formats.toml { }).generate "YaziYaziConfig" { file = (pkgs.formats.toml { }).generate "YaziYaziConfig" {
manager = { manager = {
# linemode = "mtime"; # linemode = "mtime";