From 042038024073a8bdf5d90ec23c62848ac61fd99e Mon Sep 17 00:00:00 2001 From: Matt Nish-Lapidus Date: Sat, 5 Apr 2025 13:01:20 -0400 Subject: [PATCH] yazi updates: --- flake.lock | 12 +- modules/home/yazi.nix | 1 + modules/home/yazi/init.lua | 108 ++++-------------- .../yazi/plugins/smart-paste.yazi/main.lua | 13 +++ 4 files changed, 40 insertions(+), 94 deletions(-) create mode 100644 modules/home/yazi/plugins/smart-paste.yazi/main.lua diff --git a/flake.lock b/flake.lock index 84f8b23..a2d5c0f 100644 --- a/flake.lock +++ b/flake.lock @@ -70,11 +70,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1743846340, - "narHash": "sha256-ZX+SirCnujuBuTftDXpL2IxzIO4UXGZdFiMy3pbHtRQ=", + "lastModified": 1743870111, + "narHash": "sha256-EHo0M6xC4xmZ3KmAEOi6dBsy7zuKSEyjglvoU+v8hyk=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "f529d87520a4ca4083b94c28a47b33b3d9593669", + "rev": "8eb8960e3aabf5486534c7ffad38504c53bf8d66", "type": "github" }, "original": { @@ -357,11 +357,11 @@ ] }, "locked": { - "lastModified": 1743860185, - "narHash": "sha256-TkhfJ+vH+iGxLQL6RJLObMmldAQpysVJ+p1WnnKyIeQ=", + "lastModified": 1743869639, + "narHash": "sha256-Xhe3whfRW/Ay05z9m1EZ1/AkbV1yo0tm1CbgjtCi4rQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "b5e29565131802cc8adee7dccede794226da8614", + "rev": "d094c6763c6ddb860580e7d3b4201f8f496a6836", "type": "github" }, "original": { diff --git a/modules/home/yazi.nix b/modules/home/yazi.nix index 43ef250..07cb4a1 100644 --- a/modules/home/yazi.nix +++ b/modules/home/yazi.nix @@ -73,6 +73,7 @@ dir-rules = ./yazi/plugins/dir-rules.yazi; smart-tab = ./yazi/plugins/smart-tab.yazi; + smart-paste = ./yazi/plugins/smart-paste.yazi; }; keymap = { diff --git a/modules/home/yazi/init.lua b/modules/home/yazi/init.lua index cb22b1e..07fdd20 100644 --- a/modules/home/yazi/init.lua +++ b/modules/home/yazi/init.lua @@ -1,93 +1,25 @@ require("git"):setup() require("dir-rules"):setup() --- require("yatline"):setup({ --- section_separator = { open = "", close = "" }, --- part_separator = { open = "", close = "" }, --- inverse_separator = { open = "", close = "" }, --- style_a = { --- fg = "black", --- bg_mode = { --- normal = "white", --- select = "brightyellow", --- un_set = "brightred" --- } --- }, --- style_b = { bg = "#111111", fg = "brightwhite" }, --- style_c = { bg = "#111111", fg = "brightwhite" }, +Status:children_add(function() + local h = cx.active.current.hovered + if h == nil or ya.target_family() ~= "unix" then + return "" + end --- permissions_t_fg = "green", --- permissions_r_fg = "yellow", --- permissions_w_fg = "red", --- permissions_x_fg = "cyan", --- permissions_s_fg = "white", + return ui.Line { + ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"), + ":", + ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"), + " ", + } +end, 500, Status.RIGHT) --- tab_width = 20, --- tab_use_inverse = false, - --- selected = { icon = "󰻭", fg = "yellow" }, --- copied = { icon = "", fg = "green" }, --- cut = { icon = "", fg = "red" }, - --- total = { icon = "󰮍", fg = "yellow" }, --- succ = { icon = "", fg = "green" }, --- fail = { icon = "", fg = "red" }, --- found = { icon = "󰮕", fg = "blue" }, --- processed = { icon = "󰐍", fg = "green" }, - --- show_background = true, - --- display_header_line = true, --- display_status_line = true, - --- component_positions = { "header", "tab", "status" }, - --- -- header_line = { --- -- left = { --- -- section_a = { --- -- {type = "line", custom = false, name = "tabs", params = {"left"}}, --- -- }, --- -- section_b = { --- -- }, --- -- section_c = { --- -- } --- -- }, --- -- right = { --- -- section_a = { --- -- }, --- -- section_b = { --- -- }, --- -- section_c = { --- -- } --- -- } --- -- }, - --- status_line = { --- left = { --- section_a = { --- {type = "string", custom = false, name = "tab_mode"}, --- }, --- section_b = { --- {type = "string", custom = false, name = "hovered_size"}, --- }, --- section_c = { --- {type = "string", custom = false, name = "hovered_path"}, --- { type = "coloreds", custom = false, name = "symlink" }, --- {type = "coloreds", custom = false, name = "count"}, --- } --- }, --- right = { --- section_a = { --- {type = "string", custom = false, name = "cursor_position"}, --- }, --- section_b = { --- {type = "string", custom = false, name = "cursor_percentage"}, --- }, --- section_c = { --- {type = "string", custom = false, name = "hovered_file_extension", params = {true}}, --- {type = "coloreds", custom = false, name = "permissions"}, --- {type = "string", custom = false, name = "hovered_ownership"} --- } --- } --- } --- }) +Status:children_add(function(self) + local h = self._current.hovered + if h and h.link_to then + return " -> " .. tostring(h.link_to) + else + return "" + end +end, 3300, Status.LEFT) diff --git a/modules/home/yazi/plugins/smart-paste.yazi/main.lua b/modules/home/yazi/plugins/smart-paste.yazi/main.lua new file mode 100644 index 0000000..195644c --- /dev/null +++ b/modules/home/yazi/plugins/smart-paste.yazi/main.lua @@ -0,0 +1,13 @@ +--- @sync entry +return { + entry = function() + local h = cx.active.current.hovered + if h and h.cha.is_dir then + ya.mgr_emit("enter", {}) + ya.mgr_emit("paste", {}) + ya.mgr_emit("leave", {}) + else + ya.mgr_emit("paste", {}) + end + end, +}