Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override → passing only icon and name occasionate a exception with some file extensions. #507

Open
Zeioth opened this issue Oct 17, 2024 · 1 comment

Comments

@Zeioth
Copy link

Zeioth commented Oct 17, 2024

The opts

opts = {
  override = {
    default_icon = {
      icon = "<3"
      name = "default"
    },
  },
},

Cause error with some filetypes (.service extension, for example).

screenshot_2024-10-17_17-44-33_825743289

Removing the field name, or adding the field color from default_icon, solve the issue, so something might be going on there.

The code I use to display the icons, in case it is relevant:

-- nvim-web-devicons
local devicons_avail, devicons = pcall(require, "nvim-web-devicons")
if devicons_avail then
  cached_icon_provider = function(_bufname, _filetype, _buftype)
    local icon, color = devicons.get_icon_color(_bufname)
    if not color then
      icon, color = devicons.get_icon_color_by_filetype(_filetype, { default = _buftype == "" })
    end
    return icon, color
  end
  return cached_icon_provider(bufname, filetype, buftype)
end
@alex-courtis
Copy link
Member

The override above is missing colours.

To see what icons and colours are being used, please execute :NvimWebDeviconsHiTest

To override the default icon, the best mechanism is the API e.g.

require("nvim-web-devicons").set_default_icon("<3", "#6d8086", 65)

20241018_114453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants