feat: add hl_group for file icons (#1131)

This commit is contained in:
Matthew Steedman 2022-04-04 03:33:11 -04:00 committed by GitHub
parent 6368880968
commit 924aa29092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -801,6 +801,7 @@ NvimTreeSymlink
NvimTreeFolderName
NvimTreeRootFolder
NvimTreeFolderIcon
NvimTreeFileIcon
NvimTreeEmptyFolderName
NvimTreeOpenedFolderName
NvimTreeExecFile

View File

@ -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