allow devicons default if file icon fallback is set to an empty string

This commit is contained in:
Anton Rogov 2025-06-03 12:01:52 +03:00
parent bc0630e43b
commit b18ee6a278

View file

@ -134,13 +134,14 @@ function M.icon(name, cat, opts)
return opts.fallback.dir or "󰉋 ", "Directory"
end
local Icons = require("nvim-web-devicons")
local default = opts.fallback.file == ""
if cat == "filetype" then
return Icons.get_icon_by_filetype(name, { default = false })
return Icons.get_icon_by_filetype(name, { default = default })
elseif cat == "file" then
local ext = name:match("%.(%w+)$")
return Icons.get_icon(name, ext, { default = false }) --[[@as string, string]]
return Icons.get_icon(name, ext, { default = default }) --[[@as string, string]]
elseif cat == "extension" then
return Icons.get_icon(nil, name, { default = false }) --[[@as string, string]]
return Icons.get_icon(nil, name, { default = default }) --[[@as string, string]]
end
end,
}