Skip to content

feat: add hl_group for file icons #1131

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

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/nvim-tree-lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ NvimTreeSymlink
NvimTreeFolderName
NvimTreeRootFolder
NvimTreeFolderIcon
NvimTreeFileIcon
NvimTreeEmptyFolderName
NvimTreeOpenedFolderName
NvimTreeExecFile
Expand Down
9 changes: 7 additions & 2 deletions lua/nvim-tree/renderer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ if icon_state.show_file_icon then
end
end
else
get_file_icon = function()
return #icon_state.icons.default > 0 and icon_state.icons.default .. icon_padding or ""
get_file_icon = function(_, _, line, depth)
local hl_group = "NvimTreeFileIcon"
local icon = icon_state.icons.default
if #icon > 0 then
table.insert(hl, { hl_group, line, depth, depth + #icon + 1 })
end
return #icon > 0 and icon .. icon_padding or ""
end
end
end
Expand Down