From 4a55cc5919d1de38b3345e08f37bf8a42c48ef88 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 16 Sep 2024 22:14:53 +0800 Subject: [PATCH] docs: fix linemode example --- docs/configuration/yazi.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/configuration/yazi.md b/docs/configuration/yazi.md index ad22bf5b..9bc2bd24 100644 --- a/docs/configuration/yazi.md +++ b/docs/configuration/yazi.md @@ -82,17 +82,17 @@ linemode = "size_and_mtime" ```lua -- ~/.config/yazi/init.lua function Linemode:size_and_mtime() - local year = os.date("%Y") local time = math.floor(self._file.cha.modified or 0) - - if time > 0 and os.date("%Y", time) == year then + if time == 0 then + time = "" + elseif os.date("%Y", time) == os.date("%Y") then time = os.date("%b %d %H:%M", time) else - time = time and os.date("%b %d %Y", time) or "" + time = os.date("%b %d %Y", time) end local size = self._file:size() - return ui.Line(string.format(" %s %s ", size and ya.readable_size(size) or "-", time)) + return ui.Line(string.format("%s %s", size and ya.readable_size(size) or "-", time)) end ```