Improve icon fetching logic
This commit is contained in:
parent
20b816bd8e
commit
509f0e0c3b
@ -34,15 +34,11 @@ if icon_state.show_file_icon then
|
|||||||
local web_devicons = require'nvim-web-devicons'
|
local web_devicons = require'nvim-web-devicons'
|
||||||
|
|
||||||
get_file_icon = function(fname, extension, line, depth)
|
get_file_icon = function(fname, extension, line, depth)
|
||||||
local hl_group
|
local icon, hl_group = web_devicons.get_icon(fname, extension)
|
||||||
local icon, _ = web_devicons.get_icon(fname, extension)
|
local hl_override = colors.hl_groups[fname] or colors.hl_groups[extension]
|
||||||
-- TODO: remove this hl_group and make this in nvim-web-devicons
|
hl_group = hl_override or hl_group
|
||||||
if #extension == 0 then
|
|
||||||
hl_group = colors.hl_groups[fname]
|
if icon then
|
||||||
else
|
|
||||||
hl_group = colors.hl_groups[extension]
|
|
||||||
end
|
|
||||||
if hl_group and icon then
|
|
||||||
table.insert(hl, { 'LuaTree'..hl_group, line, depth, depth + #icon })
|
table.insert(hl, { 'LuaTree'..hl_group, line, depth, depth + #icon })
|
||||||
return icon.." "
|
return icon.." "
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user