zaphyra's git: nixfiles

zaphyra's nixfiles

commit f52b760260b3ca00cd7b0727cdf2f815a94c2042
parent 3cba35c349f06ca557c394862dd94a66d7a2b351
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Sun, 29 Jun 2025 19:46:13 +0200

config/home/zaphyra/programs: add `yazi`
1 file changed, 35 insertions(+), 0 deletions(-)
A
config/home/zaphyra/programs/yazi.nix
|
35
+++++++++++++++++++++++++++++++++++
diff --git a/config/home/zaphyra/programs/yazi.nix b/config/home/zaphyra/programs/yazi.nix
@@ -0,0 +1,35 @@
+{ ... }:
+
+{
+
+  programs.yazi = {
+    enable = true;
+    settings = {
+      mgr = {
+        show_hidden = false;
+        sort_by = "natural";
+        sort_dir_first = true;
+        sort_reverse = true;
+        linemode = "size_and_mtime";
+      };
+    };
+
+    initLua = ''
+      -- ~/.config/yazi/init.lua
+      function Linemode:size_and_mtime()
+        local time = math.floor(self._file.cha.mtime or 0)
+        if time == 0 then
+          time = ""
+        elseif os.date("%Y", time) == os.date("%Y") then
+          time = os.date("%b %d %H:%M", time)
+        else
+          time = os.date("%b %d  %Y", time)
+        end
+
+        local size = self._file:size()
+        return string.format("%s %s", size and ya.readable_size(size) or "-", time)
+      end
+    '';
+  };
+
+}