-
It would be nice if we could set a linemode that could show several things at the same time, and it would be so smart that if the file/directory was created in this year, then show hours:minutes as the time, if this year earlier, then it would show the year. I attached a picture as an example: I get/created the following code:
But I get error messages: thread 'main' panicked at yazi-plugin/src/plugin.rs:42:32: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I'll write an example for you |
Beta Was this translation helpful? Give feedback.
-
Add these lines to your local old_linemode = Folder.linemode
function Folder:linemode(area, files)
if cx.active.conf.linemode ~= "my-own" then
return old_linemode(self, area)
end
local lines = {}
local year = os.date("%Y")
for _, f in ipairs(files) do
local time = f.cha.modified // 1
if time and os.date("%Y", time) == year then
time = os.date("%b %d %Y", time)
else
time = time and os.date("%b %d %H:%M", time) or ""
end
local size = f:size()
lines[#lines + 1] = ui.Line {
ui.Span(" "),
ui.Span(size and ya.readable_size(size):gsub(" ", "") or "-"),
ui.Span(" "),
ui.Span(time),
ui.Span(" "),
}
end
return ui.Paragraph(area, lines):align(ui.Paragraph.RIGHT)
end Then set [manager]
linemode = "my-own"
# ... Now you should be able to enjoy with it: |
Beta Was this translation helpful? Give feedback.
-
Thx, working great! |
Beta Was this translation helpful? Give feedback.
Add these lines to your
~/.config/yazi/init.lua