Update 2025-04-16

Update 2025-04-07

Update 2025-04-12

Update 2025-04-16
This commit is contained in:
2025-04-05 13:06:19 +03:00
parent f298468e99
commit 1077cee297
19 changed files with 369 additions and 261 deletions

View File

@@ -40,7 +40,7 @@ plugin.
## Requirements
- [Yazi][yazi-link] v25.2.26+
- [Yazi][yazi-link] v25.3.2+
- [`7z` or `7zz` command][7z-link]
- [`file` command][file-command-link]

View File

@@ -1,4 +1,4 @@
--- @since 25.2.26
--- @since 25.3.2
-- Plugin to make some Yazi commands smarter
-- Written in Lua 5.4
@@ -211,6 +211,7 @@ local ARCHIVE_FILE_EXTENSIONS = {
gzip = true,
rar = true,
s7z = true,
svgz = true,
tar = true,
tbz = true,
tbz2 = true,
@@ -1043,11 +1044,17 @@ local get_tab_preferences = ya.sync(function(_)
return tab_preferences
end)
-- [TODO]: Remove the stage.is_loading once stage() is stable
-- https://github.com/sxyazi/yazi/issues/2545
--
-- Function to get if Yazi is loading
---@type fun(): boolean
local yazi_is_loading = ya.sync(
function(_) return cx.active.current.stage.is_loading end
)
local yazi_is_loading = ya.sync(function(_)
local stage = cx.active.current.stage
local is_func, loaded = pcall(stage)
if not is_func then return stage.is_loading end
return not loaded
end)
-- Function to wait until Yazi is loaded
---@return nil
@@ -2772,19 +2779,6 @@ local function execute_create(item_url, is_directory, args, config)
enter_or_open_created_item(item_url, is_directory, args, config)
end
-- Function to get the confirm component border foreground colour
---@type fun(): Color
local get_confirm_border_fg = ya.sync(
--
-- I have no idea how to type it such that the theme
-- is accessible only within a synchronous function,
-- so disabling the diagnostic seems to be the
-- best course of action
---@diagnostic disable-next-line: undefined-global
function() return THEME.confirm.border.fg end
)
-- Function to handle the create command
---@type CommandFunction
local function handle_create(args, config)
@@ -2850,7 +2844,7 @@ local function handle_create(args, config)
ui.Line("Will overwrite the following file:")
:align(ui.Line.CENTER),
ui.Line(string.rep("", DEFAULT_CONFIRM_OPTIONS.pos.w - 2))
:style(ui.Style():fg(get_confirm_border_fg()))
:style(ui.Style(th.confirm.border))
:align(ui.Line.LEFT),
ui.Line(tostring(full_url)):align(ui.Line.LEFT),
}):wrap(ui.Text.WRAP_TRIM)
@@ -3387,6 +3381,11 @@ local wraparound_arrow = ya.sync(function(_, args)
ya.mgr_emit("reveal", merge_tables(args, { item_url }))
end)
-- [TODO]: Make use of the arrow prev and arrow next commands
-- once stabilised.
-- PR: https://github.com/sxyazi/yazi/pull/2485
-- Docs: https://yazi-rs.github.io/docs/configuration/keymap/#manager.arrow
--
-- Function to handle the arrow command
---@type CommandFunction
local function handle_arrow(args, config)