Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Apr 30, 2024
1 parent 91be9c1 commit 80a9359
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
28 changes: 18 additions & 10 deletions yazi-config/preset/theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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 = "" },
Expand Down
10 changes: 5 additions & 5 deletions yazi-plugin/preset/components/file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 80a9359

Please sign in to comment.