chore: bump the minimum required Yazi version to 25.2.7

This commit is contained in:
sxyazi
2025-02-07 20:23:05 +08:00
parent 02d18be038
commit 07258518f3
18 changed files with 56 additions and 31 deletions

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {}
for _, u in pairs(tab.selected) do

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local function info(content)
return ya.notify {
title = "Diff",

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local function setup(_, opts)
local type = opts and opts.type or ui.Border.ROUNDED
local old_build = Tab.build

View File

@@ -1,7 +1,7 @@
# git.yazi
> [!NOTE]
> Yazi v0.4.1 or later is required for this plugin to work.
> Yazi v25.2.7 or later is required for this plugin to work.
Show the status of Git file changes as linemode in the file list.

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local WIN = ya.target_family() == "windows"
local PATS = {
{ "[MT]", 6 }, -- Modified
@@ -159,9 +161,6 @@ local function fetch(_, job)
local repo = root(cwd)
if not repo then
remove(tostring(cwd))
if not ya.__250127 then -- TODO: remove this
return 1
end
return true
end
@@ -178,10 +177,6 @@ local function fetch(_, job)
:stdout(Command.PIPED)
:output()
if not output then
if not ya.__250127 then -- TODO: remove this
ya.err("Cannot spawn git command, error: " .. err)
return 0
end
return true, Err("Cannot spawn `git` command, error: %s", err)
end
@@ -208,9 +203,6 @@ local function fetch(_, job)
end
add(tostring(cwd), repo, changed)
if not ya.__250127 then -- TODO: remove this
return 3
end
return false
end

View File

@@ -1,3 +1,4 @@
--- @since 25.2.7
--- @sync entry
local function entry(st)

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."
local changed = ya.sync(function(st, new)

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local M = {}
function M:peek(job)

View File

@@ -65,12 +65,12 @@ Add following keybindings to your `~/.config/yazi/keymap.toml` to enable it:
```toml
[[manager.prepend_keymap]]
on = [ "b", "a" ]
run = 'plugin mactag --args="add"'
run = "plugin mactag add"
desc = "Tag selected files"
[[manager.prepend_keymap]]
on = [ "b", "r" ]
run = 'plugin mactag --args="remove"'
run = "plugin mactag remove"
desc = "Untag selected files"
```

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local update = ya.sync(function(st, tags)
for path, tag in pairs(tags) do
st.tags[path] = #tag > 0 and tag or nil
@@ -43,10 +45,6 @@ local function fetch(_, job)
local output, err = Command("tag"):args(paths):stdout(Command.PIPED):output()
if not output then
if not ya.__250127 then -- TODO: remove this
ya.err("Cannot spawn tag command, error: " .. err)
return 0
end
return true, Err("Cannot spawn `tag` command, error: %s", err)
end
@@ -65,9 +63,6 @@ local function fetch(_, job)
end
update(tags)
if not ya.__250127 then -- TODO: remove this
return 1
end
return true
end

View File

@@ -1,3 +1,4 @@
--- @since 25.2.7
--- @sync entry
local function entry(st)

View File

@@ -1,8 +1,11 @@
--- @since 25.2.7
local FILES = {
[".envrc"] = "text/plain",
[".gitconfig"] = "text/plain",
[".gitignore"] = "text/plain",
[".luacheckrc"] = "text/lua",
[".npmrc"] = "text/plain",
[".styluaignore"] = "text/plain",
[".zshenv"] = "text/plain",
[".zshrc"] = "text/plain",
@@ -1067,9 +1070,10 @@ function M:fetch(job)
local merged_files = ya.dict_merge(FILES, opts.with_files or {})
local merged_exts = ya.dict_merge(EXTS, opts.with_exts or {})
local updates, unknown = {}, {}
for _, file in ipairs(job.files) do
local updates, unknown, state = {}, {}, {}
for i, file in ipairs(job.files) do
if file.cha.is_dummy then
state[i] = false
goto continue
end
@@ -1082,11 +1086,11 @@ function M:fetch(job)
end
if mime then
updates[tostring(file.url)] = mime
updates[tostring(file.url)], state[i] = mime, true
elseif opts.fallback_file1 then
unknown[#unknown + 1] = file
else
updates[tostring(file.url)] = "application/octet-stream"
updates[tostring(file.url)], state[i] = "application/octet-stream", true
end
::continue::
end
@@ -1096,14 +1100,27 @@ function M:fetch(job)
end
if #unknown > 0 then
job.files = unknown
return require("mime"):fetch(job)
return self.fallback_builtin(job, unknown, state)
end
if not ya.__250127 then -- TODO: remove this
return 1
return state
end
return true
function M.fallback_builtin(job, unknown, state)
local indices = {}
for i, f in ipairs(job.files) do
indices[f:hash()] = i
end
local result = require("mime"):fetch(ya.dict_merge(job, { files = unknown }))
for i, f in unknown do
if type(result) == "table" then
state[indices[f:hash()]] = result[i]
else
state[indices[f:hash()]] = result
end
end
return state
end
return M

View File

@@ -1,7 +1,7 @@
# mount.yazi
> [!NOTE]
> The plugin is currently very experimental, and the newest Yazi nightly is required for it to work.
> Yazi v25.2.7 or later is required for this plugin to work.
A mount manager for Yazi, providing disk mount, unmount, and eject functionality.

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local toggle_ui = ya.sync(function(self)
if self.children then
Modal:children_remove(self.children)
@@ -10,7 +12,7 @@ end)
local subscribe = ya.sync(function(self)
ps.unsub("mount")
ps.sub("mount", function() ya.manager_emit("plugin", { self._id, args = "refresh" }) end)
ps.sub("mount", function() ya.manager_emit("plugin", { self._id, "refresh" }) end)
end)
local update_partitions = ya.sync(function(self, partitions)

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local function setup()
local old_layout = Tab.layout

View File

@@ -1,3 +1,4 @@
--- @since 25.2.7
--- @sync entry
local function setup(self, opts) self.open_multi = opts.open_multi end

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local hovered = ya.sync(function()
local h = cx.active.current.hovered
if not h then

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
--- Verify if `sudo` is already authenticated
--- @return boolean
local function sudo_already()