{ inputs, pkgs, lib, ... }: { programs.yazi = { enable = true; enableFishIntegration = true; package = inputs.yazi.packages.x86_64-linux.default; initLua = ./yazi/init.lua; plugins = let officialPluginsNames = [ "chmod" "diff" "git" "mount" # "toggle-pane" ]; officialPluginsSrc = pkgs.fetchgit { url = "https://github.com/yazi-rs/plugins.git"; sparseCheckout = map (p: "${p}.yazi") officialPluginsNames; rev = "HEAD"; hash = "sha256-3F44uFeFBX7PNXo2/maiAzkA/OfweyN4nbDhftna+CI="; }; officialPlugins = lib.lists.fold ( a: b: { ${a} = "${officialPluginsSrc}/${a}.yazi"; } // b ) {} officialPluginsNames; in officialPlugins // { yatline = pkgs.fetchFromGitHub { owner = "imsi32"; repo = "yatline.yazi"; rev = "HEAD"; sha256 = "sha256-JiUik4umi+ujsJmHliUbLsIj7ZTKayrWAAM8HmRdjwk="; }; starship = pkgs.fetchFromGitHub { owner = "Rolv-Apneseth"; repo = "starship.yazi"; rev = "HEAD"; sha256 = "sha256-bhLUziCDnF4QDCyysRn7Az35RAy8ibZIVUzoPgyEO1A="; }; restore = pkgs.fetchFromGitHub { owner = "boydaihungst"; repo = "restore.yazi"; rev = "HEAD"; sha256 = "sha256-OJJPgpSaUHYz8a9opVLCds+VZsK1B6T+pSRJyVgYNy8="; }; lazygit = pkgs.fetchFromGitHub { owner = "Lil-Dank"; repo = "lazygit.yazi"; rev = "HEAD"; sha256 = "sha256-OJJPgpSaUHYz8a9opVLCds+VZsK1B6T+pSRJyVgYNy8="; }; ouch = pkgs.fetchFromGitHub { owner = "ndtoan96"; repo = "ouch.yazi"; rev = "HEAD"; sha256 = "sha256-7X8uAiJ8vBXYBXOgyKhVVikOnTBGrdCcXOJemjQNolI="; }; dir-rules = ./yazi/plugins/dir-rules.yazi; smart-tab = ./yazi/plugins/smart-tab.yazi; }; keymap = { manager.prepend_keymap = [ { on = "!"; run = "shell '$SHELL' --block"; desc = "Open shell here"; } { on = ["c" "d"]; run = "shell 'ripdrag \"$@\" -x 2>/dev/null &' --confirm"; desc = "Drag selection";} { on = ["c" "c"]; run = "yank"; desc = "Copy file"; } { on = "y"; run = ["shell 'for path in \"$@\"; do echo \"file://$path\"; done | wl-copy -t text/uri-list'\n" "yank"]; } { on = ["g" "r"]; run = "shell 'ya emit cd \"$(git rev-parse --show-toplevel)\"'\n"; desc = "Go to top of git repo"; } { on = ["g" "p"]; run = "cd ~/Projects"; desc = "Go to ~/Projects"; } { on = ["g" "l"]; run = "plugin lazygit"; desc = "lazygit"; } # { on = ["t" "p"]; run = "plugin toggle-pane min-parent"; desc = "Toggle parent"; } # { on = ["t" "c"]; run = "plugin toggle-pane min-current"; desc = "Toggle current"; } # { on = ["t" "r"]; run = "plugin toggle-pane min-preview"; desc = "Toggle preview"; } { on = ""; run ="tab_create"; } { on = ""; run ="tab_close"; } { on = ""; run ="tab_switch 1 --relative"; } { on = ""; run ="tab_switch -1 --relative"; } { on = ""; run = "spot"; desc = "Spot hovered file"; } { on = "M"; run = "plugin mount"; } { on = "p"; run = "plugin smart-paste"; desc = "Paste into the hovered directory or CWD"; } { on = "C"; run = "plugin ouch zip"; } { on = "T"; run = "plugin smart-tab"; desc = "Create a tab and enter the hovered directory"; } { on = ""; run = "remove"; } { on = ["d" "d"]; run = "remove"; desc = "Delete files/folders"; } { on = ["d" "u"]; run = "plugin restore"; desc = "Restore last deleted files/folders"; } { on = "f"; run = "filter --smart"; desc = "Find file"; } { on = "F"; run = "find --smart"; desc = "Find file"; } { on = "z"; run = "plugin zoxide"; } { on = "Z"; run = "plugin fzf"; } ]; }; settings = { manager = { sort_dir_first = false; linemode = "mtime"; show_symlink = true; }; opener = { # open = [ # { run = "plugin open-with-cmd block"; desc = "Open with command in the terminal"; } # { run = "plugin open-with-cmd"; desc = "Open with command"; } # ]; edit = [ { run = "emacsclient -r -n \"$@\""; desc = "open in current emacsclient"; orphan = true; } ]; extract = [ { run = "ouch d -y \"$@\""; desc = "Extract here with ouch"; } ]; }; plugin = { prepend_preloaders = [ { name = "/mnt/**"; run = "noop"; } { name = "/home/emenel/Mounts/**"; run = "noop"; } ]; prepend_previewers = [ { name = "*.csv"; run = "rich-preview"; } { name = "*.md"; run = "rich-preview" ; } { name = "*.rst"; run = "rich-preview"; } { name = "*.ipynb"; run = "rich-preview"; } { name = "*.json"; run = "rich-preview"; } { name = "*.lisp"; run = "rich-preview"; } { name = "*.el"; run = "rich-preview"; } { name = "*.org"; run = "rich-preview"; } ]; append_previewers = [ { mime = "{image,audio,video}/*"; run = "mediainfo";} { mime = "application/x-subrip"; run = "mediainfo";} # Archive previewer { 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/octet-stream"; run = "ouch"; } ]; _spotters = [ { name = "*"; run = "file-extra-metadata"; } ]; prepend_fetchers = [ # { # id = "mime"; # name = "*"; # run = "mime-ext"; # prio = "high"; # } # { # id = "git"; # name = "*"; # run = "git"; # } # { # id = "git"; # name = "*/"; # run = "git"; # } ]; }; }; }; xdg.configFile."yazi/theme.toml".source = ./yazi/theme.toml; xdg.configFile."yazi/flavors".source = ./yazi/flavors; # xdg.configFile."yazi/plugins".source = ./yazi/plugins; }