Skip to content

(mini.icons): How to get the whole spec of icons for a particular category. #1415

Closed Answered by echasnovski
the-fuckin-nobody asked this question in Q&A
Discussion options

You must be logged in to vote

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 _G.get_all_icons('filetype') will get a map from name 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 return nil, although M…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@the-fuckin-nobody
Comment options

@echasnovski
Comment options

@the-fuckin-nobody
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants