yazi 4.0 migration

This commit is contained in:
David Chen 2024-12-15 15:51:16 -08:00
parent 823f80ccd9
commit c4f659a5fb
3 changed files with 15 additions and 14 deletions

View file

@ -201,7 +201,7 @@ keymap = [
{ on = "<F1>", run = "help", desc = "Open help" },
]
[select]
[pick]
keymap = [
{ on = "<Esc>", run = "close", desc = "Cancel selection" },

View file

@ -38,14 +38,14 @@ local function setup(_, options)
return ui.Span(" " .. mode .. " "):style(style)
end
function Status:size()
function Status:size()
local h = self._tab.current.hovered
if not h then
return ui.Line {}
return ui.Line {}
end
local style = self:style()
return ui.Span(current_separator_style.separator_close .. " " .. ya.readable_size(h:size() or h.cha.length) .. " ")
return ui.Span(current_separator_style.separator_close .. " " .. ya.readable_size(h:size() or h.cha.len) .. " ")
:fg(style.bg):bg(THEME.status.separator_style.bg)
end
@ -85,14 +85,18 @@ local function setup(_, options)
}
end
function Status:modified()
function Status:modified()
local hovered = cx.active.current.hovered
if not hovered then
return ui.Line {} -- Return empty line if no file is hovered
end
local cha = hovered.cha
local time = (cha.modified or 0) // 1
local time = (cha.mtime or 0) // 1 -- Use mtime instead of modified
return ui.Span(os.date("%Y-%m-%d %H:%M", time) .. " " .. current_separator_style.separator_open_thin .. " "):fg(
THEME.status.separator_style.fg)
end
return ui.Span(os.date("%Y-%m-%d %H:%M", time) .. " " .. current_separator_style.separator_open_thin .. " ")
:fg(THEME.status.separator_style.fg)
end
function Status:percentage()
local percent = 0
@ -127,7 +131,7 @@ local function setup(_, options)
end
Status:children_add(Status.files, 4000, Status.LEFT)
Status:children_add(Status.modified, 0, Status.RIGHT)
Status:children_add(Status.mtime, 0, Status.RIGHT)
end
return { setup = setup }

View file

@ -187,7 +187,7 @@ quit_title = "{n} task{s} running, sure to quit? (y/N)"
quit_origin = "top-center"
quit_offset = [0, 2, 50, 3]
[select]
[pick]
open_title = "Open with:"
open_origin = "hovered"
open_offset = [0, 1, 50, 7]
@ -197,6 +197,3 @@ sort_by = "none"
sort_sensitive = false
sort_reverse = false
sort_translit = false
[log]
enabled = false