feature(yazi): Add yazi plugins

This commit is contained in:
DashieTM 2025-08-23 17:15:10 +02:00
parent fb2507afe7
commit 28d08a5c8a
4 changed files with 34 additions and 16 deletions

View file

@ -1,4 +1,5 @@
{
pkgs,
lib,
config,
options,
@ -35,16 +36,26 @@
type = with lib.types; attrsOf anything;
description = "Additional keymap for yazi";
};
plugins = lib.mkOption {
default = {
inherit (pkgs.yaziPlugins) piper diff gitui;
};
example = {};
type = with lib.types; attrsOf anything;
description = "Additional keymap for yazi";
};
};
config = let
conf = import ./yazi.nix;
in
lib.optionalAttrs (options ? home.packages) (
lib.mkIf config.mods.yazi.enable {
home.packages = [pkgs.glow];
programs.yazi = {
enable = conf.enable;
settings = conf.settings // config.mods.yazi.additionalKeymap;
keymap = conf.keymap // config.mods.yazi.additionalConfig;
plugins = config.mods.yazi.plugins;
};
}
);

View file

@ -85,19 +85,23 @@
};
plugin = {
prepend_previewers = [
{
name = "*.tar";
run = ''piper --format=url -- tar tf "$1"'';
}
{
name = "*.md";
run = "glow";
run = ''piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"'';
}
{
mime = "text/csv";
run = "miller";
run = ''piper -- bat -p --color=always "$1"'';
}
];
};
};
keymap = {
manager.keymap = [
mgr.keymap = [
{
on = ["<Esc>"];
run = "escape";
@ -368,13 +372,13 @@
desc = "Cancel the ongoing search";
}
{
on = ["z"];
run = "jump zoxide";
on = ["Z"];
run = "plugin zoxide";
desc = "Jump to a directory using zoxide";
}
{
on = ["Z"];
run = "jump fzf";
on = ["z"];
run = "plugin fzf";
desc = "Jump to a directory or reveal a file using fzf";
}