Merge pull request #38 from chmln/master

Improve icon fetching logic
This commit is contained in:
Kiyan Yazdani 2020-06-14 10:30:03 +02:00 committed by GitHub
commit 8e9650f10a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,15 +34,11 @@ if icon_state.show_file_icon then
local web_devicons = require'nvim-web-devicons'
get_file_icon = function(fname, extension, line, depth)
local hl_group
local icon, _ = web_devicons.get_icon(fname, extension)
-- TODO: remove this hl_group and make this in nvim-web-devicons
if #extension == 0 then
hl_group = colors.hl_groups[fname]
else
hl_group = colors.hl_groups[extension]
end
if hl_group and icon then
local icon, hl_group = web_devicons.get_icon(fname, extension)
local hl_override = colors.hl_groups[fname] or colors.hl_groups[extension]
hl_group = hl_override or hl_group
if icon then
table.insert(hl, { 'LuaTree'..hl_group, line, depth, depth + #icon })
return icon.." "
else