module(yazi): Improve yazi configuration and add plugins for yazi
This commit is contained in:
parent
e9580543b4
commit
1add1c0393
1 changed files with 74 additions and 5 deletions
|
|
@ -1,18 +1,87 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
cfg = config.youthlic.programs.yazi;
|
cfg = config.youthlic.programs.yazi;
|
||||||
|
fish-cfg = config.youthlic.programs.fish;
|
||||||
|
bash-cfg = config.youthlic.programs.bash;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
youthlic.programs.yazi = {
|
youthlic.programs.yazi = {
|
||||||
enable = lib.mkEnableOption "yazi";
|
enable = lib.mkEnableOption "yazi";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = lib.mkMerge [
|
||||||
programs.yazi = lib.mkIf cfg.enable {
|
(lib.mkIf cfg.enable {
|
||||||
enable = true;
|
home.packages = with pkgs; [
|
||||||
};
|
starship
|
||||||
};
|
];
|
||||||
|
programs.yazi = {
|
||||||
|
enable = true;
|
||||||
|
plugins = {
|
||||||
|
inherit (pkgs.yaziPlugins) ouch starship piper chmod smart-enter git full-border;
|
||||||
|
};
|
||||||
|
initLua =
|
||||||
|
#lua
|
||||||
|
''
|
||||||
|
require("full-border"):setup()
|
||||||
|
require("starship"):setup()
|
||||||
|
require("smart-enter"):setup({
|
||||||
|
open_multi = true,
|
||||||
|
})
|
||||||
|
require("git"):setup()
|
||||||
|
'';
|
||||||
|
settings = {
|
||||||
|
plugin = {
|
||||||
|
prepend_fetchers = [
|
||||||
|
{
|
||||||
|
id = "git";
|
||||||
|
name = "*";
|
||||||
|
run = "git";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
id = "git";
|
||||||
|
name = "*/";
|
||||||
|
run = "git";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
prepend_previewers = [
|
||||||
|
{
|
||||||
|
name = "*.md";
|
||||||
|
run = "piper -- CLICOLOR_FORCE=1 ${lib.getExe pkgs.glow} --style dark --width $w $1";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "*/";
|
||||||
|
run = "piper -- ${lib.getExe pkgs.eza} '-TL=3' '--color=always' '--icons=always' --group-directories-first --no-quotes \"$1\"";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
keymap = {
|
||||||
|
mgr = {
|
||||||
|
prepend_keymap = [
|
||||||
|
{
|
||||||
|
on = ["c" "m"];
|
||||||
|
run = "plugin chmod";
|
||||||
|
desc = "Chmod on selected files";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
on = ["l"];
|
||||||
|
run = "plugin smart-enter";
|
||||||
|
desc = "Enter the child directory, or open the file";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.enable && fish-cfg.enable) {
|
||||||
|
programs.yazi.enableFishIntegration = true;
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.enable && bash-cfg.enable) {
|
||||||
|
programs.yazi.enableBashIntegration = true;
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue