mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: add more rules to [filetype] and [icon] (#966)
Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
parent
4c35f26e1f
commit
bdb28f7691
2 changed files with 27 additions and 10 deletions
|
|
@ -170,17 +170,24 @@ icon_error = ""
|
||||||
|
|
||||||
rules = [
|
rules = [
|
||||||
# Images
|
# Images
|
||||||
{ mime = "image/*", fg = "cyan" },
|
{ mime = "image/*", fg = "yellow" },
|
||||||
|
|
||||||
# Media
|
# Media
|
||||||
{ mime = "{audio,video}/*", fg = "yellow" },
|
{ mime = "{audio,video}/*", fg = "magenta" },
|
||||||
|
|
||||||
# Archives
|
# Archives
|
||||||
{ mime = "application/*zip", fg = "magenta" },
|
{ mime = "application/*zip", fg = "red" },
|
||||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "magenta" },
|
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "red" },
|
||||||
|
|
||||||
# Documents
|
# 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" },
|
||||||
|
|
||||||
|
# Special files
|
||||||
|
{ name = "*", is = "orphan", bg = "red" },
|
||||||
|
{ name = "*", is = "exec" , fg = "green" },
|
||||||
|
|
||||||
# Fallback
|
# Fallback
|
||||||
# { name = "*", fg = "white" },
|
# { name = "*", fg = "white" },
|
||||||
|
|
@ -336,6 +343,16 @@ rules = [
|
||||||
{ name = "*/Public/" , text = "" },
|
{ name = "*/Public/" , text = "" },
|
||||||
{ name = "*/Videos/" , 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
|
# Default
|
||||||
{ name = "*" , text = "" },
|
{ name = "*" , text = "" },
|
||||||
{ name = "*/", text = "" },
|
{ name = "*/", text = "" },
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ function File:highlights(file)
|
||||||
end
|
end
|
||||||
|
|
||||||
local spans, last = {}, 0
|
local spans, last = {}, 0
|
||||||
for _, r in ipairs(highlights) do
|
for _, h in ipairs(highlights) do
|
||||||
if r[1] > last then
|
if h[1] > last then
|
||||||
spans[#spans + 1] = ui.Span(name:sub(last + 1, r[1]))
|
spans[#spans + 1] = ui.Span(name:sub(last + 1, h[1]))
|
||||||
end
|
end
|
||||||
spans[#spans + 1] = ui.Span(name:sub(r[1] + 1, r[2])):style(THEME.manager.find_keyword)
|
spans[#spans + 1] = ui.Span(name:sub(h[1] + 1, h[2])):style(THEME.manager.find_keyword)
|
||||||
last = r[2]
|
last = h[2]
|
||||||
end
|
end
|
||||||
if last < #name then
|
if last < #name then
|
||||||
spans[#spans + 1] = ui.Span(name:sub(last + 1))
|
spans[#spans + 1] = ui.Span(name:sub(last + 1))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue