From 80a93591f1c4544e736341d77e8b86b2ed945b66 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 30 Apr 2024 17:50:50 +0800 Subject: [PATCH] .. --- yazi-config/preset/theme.toml | 28 +++++++++++++++++--------- yazi-plugin/preset/components/file.lua | 10 ++++----- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/yazi-config/preset/theme.toml b/yazi-config/preset/theme.toml index 1b895b9c6..8e8c5e349 100644 --- a/yazi-config/preset/theme.toml +++ b/yazi-config/preset/theme.toml @@ -173,23 +173,21 @@ rules = [ { mime = "image/*", fg = "yellow" }, # Media - { mime = "{audio,video}/*", fg = "yellow", bold = true }, + { mime = "{audio,video}/*", fg = "magenta" }, # Archives - { mime = "application/*zip", fg = "magenta" }, - { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "magenta" }, + { mime = "application/*zip", fg = "red" }, + { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "red" }, # Documents - { mime = "application/{pdf,doc,rtf,vnd.*}", fg = "green" }, + { mime = "application/{pdf,doc,rtf,vnd.*}", fg = "cyan" }, # Empty files - { mime = "inode/x-empty", fg = "red" }, + # { mime = "inode/x-empty", fg = "red" }, - # Is-rules - { name = "*" , is = "orphan", fg = "cyan", crossed = true }, - { name = "*" , is = "link" , fg = "cyan" }, - { name = "*/", is = "link" , fg = "cyan" }, - { name = "*" , is = "exec" , fg = "green" }, + # Special files + { name = "*", is = "orphan", bg = "red" }, + { name = "*", is = "exec" , fg = "green" }, # Fallback # { name = "*", fg = "white" }, @@ -344,6 +342,16 @@ rules = [ { name = "*/Public/" , text = "" }, { name = "*/Videos/" , text = "" }, + # Special files + { name = "*", is = "orphan", text = "" }, + { name = "*", is = "link" , text = "" }, + { name = "*", is = "block" , text = "" }, + { name = "*", is = "char" , text = "" }, + { name = "*", is = "fifo" , text = "" }, + { name = "*", is = "sock" , text = "" }, + { name = "*", is = "sticky", text = "" }, + { name = "*", is = "exec" , text = "" }, + # Default { name = "*" , text = "" }, { name = "*/", text = "" }, diff --git a/yazi-plugin/preset/components/file.lua b/yazi-plugin/preset/components/file.lua index d0b4a6a4e..1e7cabd20 100644 --- a/yazi-plugin/preset/components/file.lua +++ b/yazi-plugin/preset/components/file.lua @@ -24,12 +24,12 @@ function File:highlights(file) end local spans, last = {}, 0 - for _, r in ipairs(highlights) do - if r[1] > last then - spans[#spans + 1] = ui.Span(name:sub(last + 1, r[1])) + for _, h in ipairs(highlights) do + if h[1] > last then + spans[#spans + 1] = ui.Span(name:sub(last + 1, h[1])) end - spans[#spans + 1] = ui.Span(name:sub(r[1] + 1, r[2])):style(THEME.manager.find_keyword) - last = r[2] + spans[#spans + 1] = ui.Span(name:sub(h[1] + 1, h[2])):style(THEME.manager.find_keyword) + last = h[2] end if last < #name then spans[#spans + 1] = ui.Span(name:sub(last + 1))