fix: correctly use nvim-web-devicons (#1937)
Also performance improvements for utils.path_tail
This commit is contained in:
@@ -179,10 +179,14 @@ end)()
|
|||||||
|
|
||||||
utils.path_tail = (function()
|
utils.path_tail = (function()
|
||||||
local os_sep = utils.get_separator()
|
local os_sep = utils.get_separator()
|
||||||
local match_string = "[^" .. os_sep .. "]*$"
|
|
||||||
|
|
||||||
return function(path)
|
return function(path)
|
||||||
return string.match(path, match_string)
|
for i = #path, 1, -1 do
|
||||||
|
if path:sub(i, i) == os_sep then
|
||||||
|
return path:sub(i + 1, -1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return path
|
||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
@@ -431,7 +435,7 @@ utils.transform_devicons = load_once(function()
|
|||||||
return display
|
return display
|
||||||
end
|
end
|
||||||
|
|
||||||
local icon, icon_highlight = devicons.get_icon(filename, string.match(filename, "%a+$"), { default = true })
|
local icon, icon_highlight = devicons.get_icon(utils.path_tail(filename), nil, { default = true })
|
||||||
local icon_display = (icon or " ") .. " " .. (display or "")
|
local icon_display = (icon or " ") .. " " .. (display or "")
|
||||||
|
|
||||||
if conf.color_devicons then
|
if conf.color_devicons then
|
||||||
@@ -461,7 +465,7 @@ utils.get_devicons = load_once(function()
|
|||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local icon, icon_highlight = devicons.get_icon(filename, string.match(filename, "%a+$"), { default = true })
|
local icon, icon_highlight = devicons.get_icon(utils.path_tail(filename), nil, { default = true })
|
||||||
if conf.color_devicons then
|
if conf.color_devicons then
|
||||||
return icon, icon_highlight
|
return icon, icon_highlight
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user