{ user, home }: { config, lib, pkgs, ... }: let hmConfig = config.home-manager.users.${user}; in { home-manager.users.${user} = { programs = { yazi = { enable = true; enableZshIntegration = true; settings = { mgr = { show_hidden = true; }; opener = { edit = [ { run = "${hmConfig.programs.nvf.finalPackage}/bin/nvim \"$@\""; desc = "nvim"; block = true; } ] ++ lib.lists.optional hmConfig.programs.vscode.enable { run = "${hmConfig.programs.vscode.package}/bin/code \"$@\""; desc = "code"; orphan = true; }; open = [ { run = "uwsm app -- xdg-open \"$1\""; desc = "Open"; } ]; reveal = [ { run = "uwsm app -- xdg-open \"$(dirname \"$1\")\""; desc = "Reveal"; } ]; extract = [ { run = "ouch d -y \"$@\""; desc = "Extract here with ouch"; } ]; play = [ { run = "uwsm app -- mpv \"$@\""; orphan = true; } ]; }; plugin = { prepend_preloaders = [ { mime = "{audio,video,image}/*"; run = "mediainfo"; } { mime = "application/subrip"; run = "mediainfo"; } ]; prepend_previewers = [ { mime = "{audio,video,image}/*"; run = "mediainfo"; } { mime = "application/subrip"; run = "mediainfo"; } { mime = "application/*zip"; run = "ouch"; } { mime = "application/x-tar"; run = "ouch"; } { mime = "application/x-bzip2"; run = "ouch"; } { mime = "application/x-7z-compressed"; run = "ouch"; } { mime = "application/x-rar"; run = "ouch"; } { mime = "application/x-xz"; run = "ouch"; } { mime = "application/xz"; run = "ouch"; } ]; }; }; keymap = { mgr.prepend_keymap = [ { on = ""; run = "plugin smart-enter"; desc = "Enter the child directory, or open the file"; } { on = ";"; run = "plugin custom-shell -- auto --interactive"; desc = "Run a shell command"; } { on = ":"; run = "plugin custom-shell -- auto --interactive --block"; desc = "Run a shell command (block until finishes)"; } { on = "!"; run = "shell \"$SHELL\" --block"; desc = "Open $SHELL here"; } { on = "C"; run = "plugin ouch"; desc = "Compress"; } { on = "M"; run = "plugin chmod"; desc = "Chmod on selected files"; } { on = ""; run = "plugin mount"; desc = "Open the mount menu"; } ]; }; initLua = '' Status:children_add(function(self) local h = self._current.hovered if not h or not h.link_to then return "" end return " -> " .. tostring(h.link_to) end, 3300, Status.LEFT) Status:children_add(function() local h = cx.active.current.hovered if not h then return "" end return ui.Line { ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)), ":", ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)), " ", } end, 500, Status.RIGHT) ''; plugins = with pkgs.yaziPlugins; { inherit smart-enter chmod ouch mount mediainfo custom-shell ; }; }; zsh = { shellAliases.y = "yazi"; p10k.extraRightPromptElements = [ "yazi" ]; }; }; theme.template.".config/yazi/theme.toml".source = ./theme.toml; }; }