fix(icons): implement more devicon functions

This commit is contained in:
Folke Lemaitre 2024-07-03 17:56:02 +02:00
parent 9f2ee853a4
commit 208cf5f125
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -309,10 +309,32 @@ return {
opts = {},
init = function()
package.preload["nvim-web-devicons"] = function()
-- needed since it will be false when loading and mini will fail
package.loaded["nvim-web-devicons"] = {}
require("mini.icons").mock_nvim_web_devicons()
return package.loaded["nvim-web-devicons"]
local Icons = require("mini.icons")
local ret = {}
package.loaded["nvim-web-devicons"] = ret
Icons.mock_nvim_web_devicons()
local function get(cat)
local all = {}
for _, name in ipairs(Icons.list(cat)) do
local icon, color = ret.get_icon_color(cat == "file" and name, cat == "extension" and name)
all[name] = { icon = icon, color = color }
end
return all
end
ret.get_icons_by_extension = function()
return get("extension")
end
ret.get_icons_by_filename = function()
return get("file")
end
ret.get_icons = function()
return vim.tbl_extend("force", get("file"), get("extension"))
end
return ret
end
end,
},