fix: icon column highlight parameter (#366)
* fix: icon column highlight * fix: support icon highlight function --------- Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
This commit is contained in:
parent
3abb6077d7
commit
752563c59d
1 changed files with 11 additions and 4 deletions
|
|
@ -205,19 +205,19 @@ end
|
||||||
if has_devicons then
|
if has_devicons then
|
||||||
M.register("icon", {
|
M.register("icon", {
|
||||||
render = function(entry, conf)
|
render = function(entry, conf)
|
||||||
local type = entry[FIELD_TYPE]
|
local field_type = entry[FIELD_TYPE]
|
||||||
local name = entry[FIELD_NAME]
|
local name = entry[FIELD_NAME]
|
||||||
local meta = entry[FIELD_META]
|
local meta = entry[FIELD_META]
|
||||||
if type == "link" and meta then
|
if field_type == "link" and meta then
|
||||||
if meta.link then
|
if meta.link then
|
||||||
name = meta.link
|
name = meta.link
|
||||||
end
|
end
|
||||||
if meta.link_stat then
|
if meta.link_stat then
|
||||||
type = meta.link_stat.type
|
field_type = meta.link_stat.type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local icon, hl
|
local icon, hl
|
||||||
if type == "directory" then
|
if field_type == "directory" then
|
||||||
icon = conf and conf.directory or ""
|
icon = conf and conf.directory or ""
|
||||||
hl = "OilDirIcon"
|
hl = "OilDirIcon"
|
||||||
else
|
else
|
||||||
|
|
@ -230,6 +230,13 @@ if has_devicons then
|
||||||
if not conf or conf.add_padding ~= false then
|
if not conf or conf.add_padding ~= false then
|
||||||
icon = icon .. " "
|
icon = icon .. " "
|
||||||
end
|
end
|
||||||
|
if conf and conf.highlight then
|
||||||
|
if type(conf.highlight) == "function" then
|
||||||
|
hl = conf.highlight(icon)
|
||||||
|
else
|
||||||
|
hl = conf.highlight
|
||||||
|
end
|
||||||
|
end
|
||||||
return { icon, hl }
|
return { icon, hl }
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue