mirror of
https://github.com/sxyazi/yazi.git
synced 2024-09-11 10:26:35 +03: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
@ -170,17 +170,24 @@ icon_error = ""
|
||||
|
||||
rules = [
|
||||
# Images
|
||||
{ mime = "image/*", fg = "cyan" },
|
||||
{ mime = "image/*", fg = "yellow" },
|
||||
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", fg = "yellow" },
|
||||
{ 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" },
|
||||
|
||||
# Special files
|
||||
{ name = "*", is = "orphan", bg = "red" },
|
||||
{ name = "*", is = "exec" , fg = "green" },
|
||||
|
||||
# Fallback
|
||||
# { name = "*", fg = "white" },
|
||||
@ -336,6 +343,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 = "" },
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user