This commit is contained in:
sxyazi 2024-04-30 17:50:50 +08:00
parent 91be9c1d68
commit 80a93591f1
No known key found for this signature in database
2 changed files with 23 additions and 15 deletions

View file

@ -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 = "" },

View file

@ -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))