nixos-combined-flake/modules/home-manager/shell/yazi/default.nix

82 lines
2.4 KiB
Nix

{ inputs, ... }:
let
inherit (inputs) yazi-plugins mediainfo-yazi starship-yazi open-with-cmd-yazi;
in
{
programs = {
yazi = {
enable = true;
enableZshIntegration = true;
shellWrapperName = "y";
plugins = {
chmod = "${yazi-plugins}/chmod.yazi";
#full-border = "${yazi-plugins}/full-border.yazi";
git = "${yazi-plugins}/git.yazi";
smart-enter = "${yazi-plugins}/smart-enter.yazi";
starship = starship-yazi;
mediainfo = mediainfo-yazi;
open-with-cmd = open-with-cmd-yazi;
};
initLua = ''
--require("full-border"):setup()
require("starship"):setup()
require("git"):setup()
require("smart-enter"):setup({
open_multi = true,
})
'';
settings = {
sort_by = "name";
sort_dir_first = true;
sort_reverse = false;
plugin = {
prepend_fetchers = [
{ id = "git"; name = "*"; run = "git"; }
{ id = "git"; name = "*/"; run = "git"; }
];
prepend_previewers = [
{ mime = "{image,audio,video}/*"; run = "mediainfo"; }
{ mime = "application/subrip"; run = "mediainfo"; }
];
};
};
keymap = {
manager.prepend_keymap = [
{ on = "K"; run = "seek -20"; desc = "Seek up 20 units in the preview"; }
{ on = "J"; run = "seek 20"; desc = "Seek down 20 units in the preview"; }
{
run = "cd /media/net/svartalbenheim/media_data/";
on = [ "g" "m" ];
desc = "Cd to media_data";
}
{
run = "cd /media/net/svartalbenheim/media_data/media/Video";
on = [ "g" "v" ];
desc = "Cd to media_data";
}
{
run = "cd /media/net/svartalbenheim/media_data/media/Audio";
on = [ "g" "a" ];
desc = "Cd to media_data";
}
{
run = "plugin smart-enter";
on = [ "l" ];
desc = "Enter the child directory, or open the file";
}
{
on = "o";
run = "plugin open-with-cmd --args=block";
desc = "Open with command in the terminal";
}
{
on = "O";
run = "plugin open-with-cmd";
desc = "Open with command";
}
];
};
};
};
}