nvim-tree / nvim-web-devicons

lua `fork` of vim-web-devicons for neovim
MIT License
1.92k stars 181 forks source link

set_icon not work #465

Closed minhanghuang closed 1 month ago

minhanghuang commented 1 month ago

I tried to change launch file icon, but it seems that the changes has not taken effect, the previous changes were not a problem and I don't know from which version the problem started

system: Ubuntu20.04 docker container
Neovim: 0.10.0 stable
nvim-web-devicons: 11eb26fc166742db8d1e8a6f5a7de9df37b09aae
nvim-tree.lua: 76db7ed0da3027882dd0a72de18643c2e26956dc(branch: nvim-tree-v1.3.1)
local has_web_devicons, web_devicons = pcall(require, "nvim-web-devicons")
if not has_web_devicons then
  vim.notify("nvim-web-devicons not found!")
  return
end

local my_icons = {
  ["inl"] = {
    icon = "",
    color = "#a074c4",
    cterm_color = "140",
    name = "Hpp"
  },
  ["urdf"] = {
    icon = "謹",
    color = "#e37933",
    cterm_color = "173",
    name = "Xml",
  },
  ["xodr"] = {
    icon = "謹",
    color = "#e37933",
    cterm_color = "173",
    name = "Xml",
  },
  ["cu"] = {
    icon = "",
    color = "#f34b7d",
    cterm_color = "204",
    name = "CPlusPlus",
  },
  ["launch"] = {
    icon = "謹",
    color = "#e37933",
    cterm_color = "173",
    name = "Xml",
  },
}

if web_devicons.has_loaded then
  web_devicons.set_icon(my_icons)
else
  web_devicons.setup({ override = my_icons, default = true })
end

image

minhanghuang commented 1 month ago

I will switch nvim-web-devicons back to historical commit 2d02a56 and it will be resolved image

alex-courtis commented 1 month ago

Thanks for the detailed report.

I'd be most grateful if you could test this fix:

cd /path/to/nvim-web-devicons
git pull
git checkout 465-set_icon-broken

When you're finished testing:

git checkout master
minhanghuang commented 1 month ago

Ok, tested it, works like a charm! thank you very much! image