193 lines
6.6 KiB
Nix
193 lines
6.6 KiB
Nix
{ 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"
|
|
"smart-paste"
|
|
"toggle-pane"
|
|
];
|
|
|
|
officialPluginsSrc = pkgs.fetchgit {
|
|
url = "https://github.com/yazi-rs/plugins.git";
|
|
sparseCheckout = map (p: "${p}.yazi") officialPluginsNames;
|
|
hash = "sha256-bre666Z5qEqkt3c2wLfX5tI2+JMoeRdP4721bJeanKs=";
|
|
};
|
|
|
|
officialPlugins =
|
|
lib.lists.fold (
|
|
a: b:
|
|
{
|
|
${a} = "${officialPluginsSrc}/${a}.yazi";
|
|
}
|
|
// b
|
|
)
|
|
{}
|
|
officialPluginsNames;
|
|
in
|
|
officialPlugins // {
|
|
restore = pkgs.fetchFromGitHub {
|
|
owner = "boydaihungst";
|
|
repo = "restore.yazi";
|
|
rev = "HEAD";
|
|
sha256 = "sha256-3Z8P25u9bffdjrPjxLRWUQn6MdBS+vyElUBkgV4EUwY=";
|
|
};
|
|
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=";
|
|
};
|
|
rich-preview = pkgs.fetchFromGitHub {
|
|
owner = "AnirudhG07";
|
|
repo = "rich-preview.yazi";
|
|
rev = "HEAD";
|
|
sha256 = "sha256-dW2gAAv173MTcQdqMV32urzfrsEX6STR+oCJoRVGGpA=";
|
|
};
|
|
mediainfo= pkgs.fetchFromGitHub {
|
|
owner = "boydaihungst";
|
|
repo = "mediainfo.yazi";
|
|
rev = "HEAD";
|
|
sha256 = "sha256-U6rr3TrFTtnibrwJdJ4rN2Xco4Bt4QbwEVUTNXlWRps=";
|
|
};
|
|
|
|
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" "y"]; run = "yank"; desc = "Copy file (yank)"; }
|
|
{ on = "y"; run = ["shell 'for path in \"$@\"; do echo \"file://$path\"; done | wl-copy -t text/uri-list'\n" "yank"]; desc = "Yank selected files (copy)"; }
|
|
|
|
{ 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 = "<C-t>"; run ="tab_create"; }
|
|
{ on = "<C-w>"; run ="close"; }
|
|
{ on = "<C-A-right>"; run ="tab_switch 1 --relative"; }
|
|
{ on = "<C-A-left>"; run ="tab_switch -1 --relative"; }
|
|
{ on = "<C-1>"; run ="tab_switch 0"; }
|
|
{ on = "<C-2>"; run ="tab_switch 1"; }
|
|
{ on = "<C-3>"; run ="tab_switch 2"; }
|
|
{ on = "<C-4>"; run ="tab_switch 3"; }
|
|
|
|
{ on = "<Tab>"; 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 = "<Backspace>"; run = "remove"; }
|
|
{ on = ["d" "d"]; run = "remove"; desc = "Delete files/folders"; }
|
|
{ on = ["d" "u"]; run = "plugin restore"; desc = "Restore last deleted files/folders"; }
|
|
{ on = ["d" "x"]; run = "shell 'trash-empty'"; desc = "Empty trash"; }
|
|
|
|
{ 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 = {
|
|
edit = [
|
|
{ run = "$EDITOR \"$@\""; desc = "emacsclient"; orphan = true; block = false; }
|
|
{ run = "nano \"$@\""; desc = "nano"; orphan = false; block = true; }
|
|
];
|
|
extract = [
|
|
{ run = "ouch d -y \"$@\""; desc = "Extract here with ouch"; }
|
|
];
|
|
};
|
|
open = {
|
|
prepend_rules = [
|
|
{ name = "*.zip"; use = "extract"; }
|
|
];
|
|
};
|
|
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 = "*.org"; run = "rich-preview"; }
|
|
];
|
|
append_previewers = [
|
|
{ mime = "{image,audio,video}/*"; run = "mediainfo";}
|
|
{ mime = "application/x-subrip"; run = "mediainfo";}
|
|
# Archive previewer
|
|
{ name = "*.zip"; run = "ouch"; }
|
|
{ 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";
|
|
}
|
|
];
|
|
};
|
|
tasks = {
|
|
image_alloc = 53687091;
|
|
image_bound = [ 0 0 ];
|
|
};
|
|
};
|
|
};
|
|
|
|
xdg.configFile."yazi/theme.toml".source = ./yazi/theme.toml;
|
|
xdg.configFile."yazi/flavors".source = ./yazi/flavors;
|
|
xdg.configFile."xdg-desktop-portal-termfilechooser/config".source = ./file-chooser/config;
|
|
home.file.".local/bin/yazi-wrapper.sh".source = ./file-chooser/yazi-wrapper.sh;
|
|
}
|