Update 2025-04-26

This commit is contained in:
2025-04-26 23:21:08 +03:00
parent 1077cee297
commit 90d846ea20
13 changed files with 1137 additions and 511 deletions

View File

@@ -1,4 +1,4 @@
--- @since 25.2.7
--- @since 25.4.8
-- stylua: ignore
local MOTIONS_AND_OP_KEYS = {
{ on = "0" }, { on = "1" }, { on = "2" }, { on = "3" }, { on = "4" },
@@ -76,9 +76,9 @@ local render_motion = ya.sync(function(_, motion_num, motion_cmd)
motion_span = ui.Span(string.format(" %3d%s ", motion_num, motion_cmd))
end
local status_config = THEME.status
local separator_open = status_config.separator_open or status_config.sep_right.open
local separator_close = status_config.separator_close or status_config.sep_right.close
local status_config = th.status
local separator_open = status_config.sep_right.open
local separator_close = status_config.sep_right.close
return ui.Line {
ui.Span(separator_open):fg(style.main.bg),
@@ -124,13 +124,7 @@ local render_numbers = ya.sync(function(_, mode)
local hovered_index
for i, f in ipairs(files) do
-- TODO: Removed f:is_hovered() support in next Yazi release
if type(f.is_hovered) == "boolean" then
hovered = f.is_hovered
else
hovered = f:is_hovered()
end
if hovered then
if f.is_hovered then
hovered_index = i
break
end
@@ -274,8 +268,8 @@ return {
if cmd == "g" then
if direction == "g" then
ya.manager_emit("arrow", { "top" })
ya.manager_emit("arrow", { lines - 1 })
ya.mgr_emit("arrow", { "top" })
ya.mgr_emit("arrow", { lines - 1 })
render_clear()
return
elseif direction == "j" then
@@ -283,7 +277,7 @@ return {
elseif direction == "k" then
cmd = "k"
elseif direction == "t" then
ya.manager_emit("tab_switch", { lines - 1 })
ya.mgr_emit("tab_switch", { lines - 1 })
render_clear()
return
else
@@ -294,66 +288,66 @@ return {
end
if cmd == "j" then
ya.manager_emit("arrow", { lines })
ya.mgr_emit("arrow", { lines })
elseif cmd == "k" then
ya.manager_emit("arrow", { -lines })
ya.mgr_emit("arrow", { -lines })
elseif cmd == "h" then
for _ = 1, lines do
ya.manager_emit("leave", {})
ya.mgr_emit("leave", {})
end
elseif cmd == "l" then
for _ = 1, lines do
ya.manager_emit("enter", {})
ya.mgr_emit("enter", {})
local file_idx = get_cache_or_first_dir()
if file_idx then
ya.manager_emit("arrow", { "top" })
ya.manager_emit("arrow", { file_idx })
ya.mgr_emit("arrow", { "top" })
ya.mgr_emit("arrow", { file_idx })
end
end
elseif is_tab_command(cmd) then
if cmd == "t" then
for _ = 1, lines do
ya.manager_emit("tab_create", {})
ya.mgr_emit("tab_create", {})
end
elseif cmd == "H" then
ya.manager_emit("tab_switch", { -lines, relative = true })
ya.mgr_emit("tab_switch", { -lines, relative = true })
elseif cmd == "L" then
ya.manager_emit("tab_switch", { lines, relative = true })
ya.mgr_emit("tab_switch", { lines, relative = true })
elseif cmd == "w" then
ya.manager_emit("tab_close", { lines - 1 })
ya.mgr_emit("tab_close", { lines - 1 })
elseif cmd == "W" then
local curr_tab = get_active_tab()
local del_tab = curr_tab + lines - 1
for _ = curr_tab, del_tab do
ya.manager_emit("tab_close", { curr_tab - 1 })
ya.mgr_emit("tab_close", { curr_tab - 1 })
end
ya.manager_emit("tab_switch", { curr_tab - 1 })
ya.mgr_emit("tab_switch", { curr_tab - 1 })
elseif cmd == "<" then
ya.manager_emit("tab_swap", { -lines })
ya.mgr_emit("tab_swap", { -lines })
elseif cmd == ">" then
ya.manager_emit("tab_swap", { lines })
ya.mgr_emit("tab_swap", { lines })
elseif cmd == "~" then
local jump = lines - get_active_tab()
ya.manager_emit("tab_swap", { jump })
ya.mgr_emit("tab_swap", { jump })
end
else
ya.manager_emit("visual_mode", {})
ya.mgr_emit("visual_mode", {})
-- invert direction when user specifies it
if direction == "k" then
ya.manager_emit("arrow", { -lines })
ya.mgr_emit("arrow", { -lines })
elseif direction == "j" then
ya.manager_emit("arrow", { lines })
ya.mgr_emit("arrow", { lines })
else
ya.manager_emit("arrow", { lines - 1 })
ya.mgr_emit("arrow", { lines - 1 })
end
ya.manager_emit("escape", {})
ya.mgr_emit("escape", {})
if cmd == "d" then
ya.manager_emit("remove", {})
ya.mgr_emit("remove", {})
elseif cmd == "y" then
ya.manager_emit("yank", {})
ya.mgr_emit("yank", {})
elseif cmd == "x" then
ya.manager_emit("yank", { cut = true })
ya.mgr_emit("yank", { cut = true })
end
end