mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-28 06:34:42 +02:00
fix(icons): implement more devicon functions
This commit is contained in:
parent
9f2ee853a4
commit
208cf5f125
1 changed files with 26 additions and 4 deletions
|
@ -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,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue