-
What system are you running Yazi on?Linux Wayland What terminal are you running Yazi in?foot 1.19.0
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
The error message doesn't seem to be directly related to the linemode functionality itself. I tested the solution provided in the discussion you shared, and it still works.
To update the solution to match the current properties, simply change function Linemode:custom()
local year = os.date("%Y")
- local time = (self._file.cha.modified or 0) // 1
+ local time = (self._file.cha.mtime or 0) // 1
if time > 0 and os.date("%Y", time) == year then
time = os.date("%b %d %H:%M", time) So my suggestion would be to double-check the code inside your |
Beta Was this translation helpful? Give feedback.
-
Repaced 'modified' with 'mtime' and 'permissions' with 'perm' but still the same error message.
|
Beta Was this translation helpful? Give feedback.
-
I see. The error message originates from the following expression: if actualyear = actualfileyear To fix it, you can make the following change: local actualyear = os.date("%Y", actualtime)
local size = f:size()
local actualfileyear = os.date("%Y", time)
- if actualyear = actualfileyear
+ if actualyear == actualfileyear then
spans[#spans + 1] = ui.Span(size and ya.readable_size(size) or "")
spans[#spans + 1] = ui.Span(time and os.date("%b %d %Y", time // 1) or "")
else However, using this code will result in another error message. The solution is the same as the one provided in the discussion you linked: #1288 (comment) This means your function ya.readable_size(size)
local units = { "B", "KB", "MB", "GB", "TB", "PB", "EB" }
local i = 1
while size > 1024.0 and i < #units do
size = size / 1024.0
i = i + 1
end
return string.format("%.f%s", size, units[i])
end
function Linemode:custom()
local year = os.date("%Y")
local time = (self._file.cha.mtime or 0) // 1
if time > 0 and os.date("%Y", time) == year then
time = os.date("%b %d %H:%M", time)
else
time = time and os.date("%b %d %Y", time) or ""
end
local size = self._file:size()
return ui.Line(string.format(" %s %s ", size and ya.readable_size(size):gsub(" ", "") or "-", time))
end
If you want to display this custom linemode by default, ensure the following is added to your [manager]
linemode = "custom" To use it with a keymap, you can include it in your [[manager.prepend_keymap]]
on = ["m", "c"]
run = "linemode custom"
desc = "Linemode: custom" Let me know if this works for you! |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, Filipe! Now it works. |
Beta Was this translation helpful? Give feedback.
I see. The error message originates from the following expression:
To fix it, you can make the following change:
However, using th…