(mini.icons): How to get the whole spec of icons for a particular category. #1415
-
As the title suggests, is there any way to fetch a table consisting of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The answer is both "yes" and "no". The "yes" part is that it is indeed possible with the following: _G.get_all_icons = function(category)
local res = {}
for _, name in ipairs(MiniIcons.list(category)) do
local icon, hl = MiniIcons.get(category, name)
res[name] = { glyph = icon, hl = hl }
end
return res
end Then calling The "no" part is that it will work for all but "extension" and "file" categories, because they rely on |
Beta Was this translation helpful? Give feedback.
The answer is both "yes" and "no".
The "yes" part is that it is indeed possible with the following:
Then calling
_G.get_all_icons('filetype')
will get a map fromname
to icon data (glyph and highlight group).The "no" part is that it will work for all but "extension" and "file" categories, because they rely on
vim.filetype.match()
to first get corresponding filetype and then get icon data from it. For example_G.get_all_icons('extension').lua
will returnnil
, althoughM…