yazi play

This commit is contained in:
Matt Nish-Lapidus 2025-06-13 16:57:38 -04:00
parent 26225b7efb
commit a47c7afc26
2 changed files with 118 additions and 12 deletions

View file

@ -19,6 +19,14 @@
rich-preview = rich-preview;
mediainfo= mediainfo;
starship = starship;
smart-filter = smart-filter;
open-with-cmd = pkgs.fetchFromGitHub {
owner = "Ape";
repo = "open-with-cmd.yazi";
rev = "HEAD";
sha256 = "sha256-QazKfNEPFdkHwMrH4D+VMwj8fGXM8KHDdSvm1tik3dQ=";
};
office = pkgs.fetchFromGitHub {
owner = "macydnah";
@ -27,7 +35,28 @@
sha256 = "sha256-XE+EfVPsO09zG8qYEhN6O95mS9NJlTdOd4Gsem2KtPI=";
};
dir-rules = ./yazi/plugins/dir-rules.yazi;
exifaudio = pkgs.fetchFromGitHub {
owner = "Sonico98";
repo = "exifaudio.yazi";
rev = "HEAD";
sha256 = "sha256-aniuY14pXcoaW6YkUwt7hTl9mWjl5HoOPhHkuY4ooAw=";
};
time-travel = pkgs.fetchFromGitHub {
owner = "iynaix";
repo = "time-travel.yazi";
rev = "HEAD";
sha256 = "sha256-ZZgn5rsBzvZcnDWZfjMBPRg9QUz4FTq5UIPWfnwXHQs=";
};
pref-by-location = pkgs.fetchFromGitHub {
owner = "boydaihungst";
repo = "pref-by-location.yazi";
rev = "HEAD";
sha256 = "sha256-miFoKtMKbN58wH+f+auk2YLVfTTwyvuTW1VAHrNL5fA=";
};
# dir-rules = ./yazi/plugins/dir-rules.yazi;
smart-tab = ./yazi/plugins/smart-tab.yazi;
};
@ -47,8 +76,13 @@
{ on = "p"; run = "plugin smart-paste"; }
{ on = "P"; run = "plugin smart-paste --force"; }
{ on = "v"; run = "plugin smart-paste"; }
{ on = "V"; run = "plugin smart-paste --force"; }
{ on = ["t" "p"]; run = "plugin toggle-pane min-preview";desc = "Show or hide the preview pane"; }
{ on = ["t" "P"]; run = "plugin toggle-pane max-preview";desc = "Maximize/restore the preview pane"; }
{ on = ["t" "g"]; run = "plugin lazygit"; desc = "Lazygit"; }
# { on = ["b" "p"]; run = "plugin time-travel --args=prev"; desc = "Previous snapshot"; }
# { on = ["b" "n"]; run = "plugin time-travel --args=next"; desc = "Next snapshot"; }
# { on = ["b" "q"]; run = "plugin time-travel --args=exit"; desc = "Exit snapshot"; }
{ on = "<C-t>"; run ="tab_create"; }
{ on = "<C-w>"; run ="close"; }
@ -77,6 +111,39 @@
{ on = "z"; run = "plugin zoxide"; }
{ on = "Z"; run = "plugin fzf"; }
# { on = "."; run = [ "hidden toggle" "plugin pref-by-location -- save" ]; desc = "Toggle the visibility of hidden files";}
# # Linemod
# { on = [ "m" "s" ]; run = [ "linemode size" "plugin pref-by-location -- save" ]; desc = "Linemode: size"; }
# { on = [ "m" "p" ]; run = [ "linemode permissions" "plugin pref-by-location -- save" ]; desc = "Linemode: permissions"; }
# { on = [ "m" "b" ]; run = [ "linemode btime" "plugin pref-by-location -- save" ]; desc = "Linemode: btime"; }
# { on = [ "m" "m" ]; run = [ "linemode mtime" "plugin pref-by-location -- save" ]; desc = "Linemode: mtime"; }
# { on = [ "m" "o" ]; run = [ "linemode owner" "plugin pref-by-location -- save" ]; desc = "Linemode: owner"; }
# { on = [ "m" "n" ]; run = [ "linemode none" "plugin pref-by-location -- save" ]; desc = "Linemode: none"; }
# # Any changes during disabled state won't be saved to save file
# { on = [ "," "t" ]; run = "plugin pref-by-location -- toggle"; desc = "Tol auto-save preferences"; }
# { on = [ "," "d" ]; run = "plugin pref-by-location -- disable"; desc = "Dibe auto-save preferences"; }
# # This will reset any preference changes for the current working directory (CWD)
# # then fall back to the predefined preferences in init.lua or yazi.toml
# { on = [ "," "R" ]; run = [ "plugin pref-by-location -- reset" ]; desc = "Retpreference of cwd"; }
# { on = [ "," "m" ]; run = [ "sort mtime --reverse=no" "linemode mtime" "plugin pref-by-location -- save" ]; desc = "So y modified time"; }
# { on = [ "," "M" ]; run = [ "sort mtime --reverse" "linemode mtime" "plugin pref-by-location -- save" ]; desc = "So y modified time (reverse)"; }
# { on = [ "," "b" ]; run = [ "sort btime --reverse=no" "linemode btime" "plugin pref-by-location -- save" ]; desc = "So y birth time"; }
# { on = [ "," "B" ]; run = [ "sort btime --reverse" "linemode btime" "plugin pref-by-location -- save" ]; desc = "So y birth time (reverse)"; }
# { on = [ "," "e" ]; run = [ "sort extension --reverse=no" "plugin pref-by-location -- save" ]; desc = "So y extension"; }
# { on = [ "," "E" ]; run = [ "sort extension --reverse" "plugin pref-by-location -- save" ]; desc = "So y extension (reverse)"; }
# { on = [ "," "a" ]; run = [ "sort alphabetical --reverse=no" "plugin pref-by-location -- save" ]; desc = "So lphabetically"; }
# { on = [ "," "A" ]; run = [ "sort alphabetical --reverse" "plugin pref-by-location -- save" ]; desc = "So lphabetically (reverse)"; }
# { on = [ "," "n" ]; run = [ "sort natural --reverse=no" "plugin pref-by-location -- save" ]; desc = "So aturally"; }
# { on = [ "," "N" ]; run = [ "sort natural --reverse" "plugin pref-by-location -- save" ]; desc = "So aturally (reverse)"; }
# { on = [ "," "s" ]; run = [ "sort size --reverse=no" "linemode size" "plugin pref-by-location -- save" ]; desc = "So y size"; }
# { on = [ "," "S" ]; run = [ "sort size --reverse" "linemode size" "plugin pref-by-location -- save" ]; desc = "So y size (reverse)"; }
# { on = [ "," "r" ]; run = [ "sort random --reverse=no" "plugin pref-by-location -- save" ]; desc = "So andomly"; }
];
};
settings = {
@ -104,9 +171,6 @@
{ name = "/home/emenel/Mounts/**"; run = "noop"; }
{ name = "/mnt/**"; run = "noop"; }
# { mime = "{image,audio,video}/*"; run = "mediainfo";}
# { mime = "application/x-subrip"; run = "mediainfo";}
# Office Documents
{ mime = "application/openxmlformats-officedocument.*"; run = "office"; }
{ mime = "application/oasis.opendocument.*"; run = "office"; }
@ -116,8 +180,7 @@
];
prepend_previewers = [
# { mime = "{image,audio,video}/*"; run = "mediainfo";}
# { mime = "application/x-subrip"; run = "mediainfo";}
{ mime = "audio/*"; run = "exifaudio"; }
# { name = "*.csv"; run = "rich-preview"; }
# { name = "*.md"; run = "rich-preview" ; }

View file

@ -5,12 +5,55 @@ th.git = th.git or {}
th.git.modified_sign = "M"
th.git.deleted_sign = "D"
require("dir-rules"):setup()
require("restore"):setup({
position = { "center", w = 70, h = 40 },
show_confirm = true,
})
show_confirm = true })
local pref_by_location = require("pref-by-location")
pref_by_location:setup({
-- Disable this plugin completely.
-- disabled = false -- true|false (Optional)
-- Hide "enable" and "disable" notifications.
-- no_notify = false -- true|false (Optional)
-- You can backup/restore this file. But don't use same file in the different OS.
-- save_path = -- full path to save file (Optional)
-- - Linux/MacOS: os.getenv("HOME") .. "/.config/yazi/pref-by-location"
-- - Windows: os.getenv("APPDATA") .. "\\yazi\\config\\pref-by-location"
-- You don't have to set "prefs". Just use keymaps below work just fine
prefs = { -- (Optional)
-- location: String | Lua pattern (Required)
-- - Support literals full path, lua pattern (string.match pattern): https://www.lua.org/pil/20.2.html
-- And don't put ($) sign at the end of the location. %$ is ok.
-- - If you want to use special characters (such as . * ? + [ ] ( ) ^ $ %) in "location"
-- you need to escape them with a percent sign (%) or use a helper funtion `pref_by_location.is_literal_string`
-- Example: "/home/test/Hello (Lua) [world]" => { location = "/home/test/Hello %(Lua%) %[world%]", ....}
-- or { location = pref_by_location.is_literal_string("/home/test/Hello (Lua) [world]"), .....}
-- sort: {} (Optional) https://yazi-rs.github.io/docs/configuration/yazi#mgr.sort_by
-- - extension: "none"|"mtime"|"btime"|"extension"|"alphabetical"|"natural"|"size"|"random", (Optional)
-- - reverse: true|false (Optional)
-- - dir_first: true|false (Optional)
-- - translit: true|false (Optional)
-- - sensitive: true|false (Optional)
-- linemode: "none" |"size" |"btime" |"mtime" |"permissions" |"owner" (Optional) https://yazi-rs.github.io/docs/configuration/yazi#mgr.linemode
-- - Custom linemode also work. See the example below
-- show_hidden: true|false (Optional) https://yazi-rs.github.io/docs/configuration/yazi#mgr.show_hidden
-- Some examples:
-- Match any folder which has path start with "/mnt/remote/". Example: /mnt/remote/child/child2
-- { location = "^/mnt/remote/.*", sort = { "extension", reverse = false, dir_first = true, sensitive = false} },
-- Match any folder with name "Downloads"
{ location = ".*/Downloads", sort = { "btime", reverse = true, dir_first = true }, linemode = "btime" },
-- Match exact folder with absolute path "/home/test/Videos".
-- Use helper function `pref_by_location.is_literal_string` to prevent the case where the path contains special characters
-- { location = pref_by_location.is_literal_string("/home/test/Videos"), sort = { "btime", reverse = true, dir_first = true }, linemode = "btime" },
},
})
Status:children_add(function()
local h = cx.active.current.hovered