Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: icon column highlight #366

Merged
merged 2 commits into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions lua/oil/columns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,19 @@ end
if has_devicons then
M.register("icon", {
render = function(entry, conf)
local type = entry[FIELD_TYPE]
local field_type = entry[FIELD_TYPE]
local name = entry[FIELD_NAME]
local meta = entry[FIELD_META]
if type == "link" and meta then
if field_type == "link" and meta then
if meta.link then
name = meta.link
end
if meta.link_stat then
type = meta.link_stat.type
field_type = meta.link_stat.type
end
end
local icon, hl
if type == "directory" then
if field_type == "directory" then
icon = conf and conf.directory or ""
hl = "OilDirIcon"
else
Expand All @@ -230,6 +230,13 @@ if has_devicons then
if not conf or conf.add_padding ~= false then
icon = icon .. " "
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 }
end,

Expand Down
Loading