nvim-tree / nvim-web-devicons

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

Default icon is not working correctly #449

Closed sethen closed 2 months ago

sethen commented 2 months ago

I've set a default icon but for whatever reason it's not being picked up by certain files. For instance:

Screenshot from 2024-04-22 19-03-18

However, the setup shows the icon perfectly fine:

Screenshot from 2024-04-22 19-04-14

As you can see the editor renders the page icon just fine but it is not applying it to all icons as a default.

sethen commented 2 months ago

I solved some of my issue. Part of it was I had to set some things for the file tree explorer itself. However, the default icon isn't working for everything.

alex-courtis commented 2 months ago

To confirm: does the default default icon show when you remove set_default_icon ?

sethen commented 2 months ago

To confirm: does the default default icon show when you remove set_default_icon ?

Not sure what you mean... if I delete the set_delete_icon function does the default icon show??

sethen commented 2 months ago

Here is also another thing I am seeing -- I would assume the default icon would take over here when the TelescopePrompt comes up but it doesn't... However, it does when the help buffer is open. Check the status bar on the bottom right.

No default icon: Screenshot from 2024-04-24 19-39-35

Default icon: Screenshot from 2024-04-24 19-42-28

alex-courtis commented 2 months ago

Experimenting with your setup:

require("nvim-web-devicons").set_default_icon('D', '#6d8086', 65)
print(vim.inspect(require("nvim-web-devicons").get_default_icon()))
{
  color = "#6d8086",
  cterm_color = 65,
  icon = "D",
  name = "Default"
}
require("nvim-web-devicons").set_default_icon('X')
print(vim.inspect(require("nvim-web-devicons").get_default_icon()))
{
  icon = "X",
  name = "Default"
}

That is working as intended, presuming that icon in your screenshot is require("nvim-web-devicons")

alex-courtis commented 2 months ago

To confirm: does the default default icon show when you remove set_default_icon ?

Not sure what you mean... if I delete the set_delete_icon function does the default icon show??

Yes.

However... that's not to say that nvim-tree, telescope or lualine will actually use it, they may use their own.

Experimenting with nvim-tree and :NvimWebDeviconsHiTest shows that the default icon is not shown or used. Investigating...

alex-courtis commented 2 months ago

:NvimWebDeviconsHiTest not showing the default is unrelated. Fixed at #451

nvim-tree is not showing the default icon, contradicting help:

            *nvim-tree.renderer.icons.web_devicons.file.enable*
            Show icons on files.
            Overrides |nvim-tree.renderer.icons.glyphs.default|
              Type: `boolean`, Default: `true`

        *nvim-tree.renderer.icons.glyphs.default*
        Glyph for files.
        Overridden by |nvim-tree.renderer.icons.web_devicons| if available.
          Type: `string`, Default: `""`

Raised https://github.com/nvim-tree/nvim-tree.lua/issues/2758

alex-courtis commented 2 months ago

RE lualine: it does not show default icons. I'll leave telescope to you...

Does resolution of this issue resolve your concerns? https://github.com/nvim-tree/nvim-tree.lua/issues/2758#issuecomment-2081313671

sethen commented 2 months ago

RE lualine: it does not show default icons. I'll leave telescope to you...

Does resolution of this issue resolve your concerns? nvim-tree/nvim-tree.lua#2758 (comment)

I left a comment over there. Happy to test, just unsure how.

alex-courtis commented 2 months ago

Fixed via nvim-tree https://github.com/nvim-tree/nvim-tree.lua/pull/2759

sethen commented 2 months ago

@alex-courtis Still not seeing the default icon taking effect even after updating nvim-tree.

alex-courtis commented 1 month ago

@alex-courtis Still not seeing the default icon taking effect even after updating nvim-tree.

That's no good; we'll get to the bottom of this. I reckon it's nvim-tree.

Please raise an nvim-tree bug report with your nvim-tree and nvim-webdevicons minimal configuration so that we may reproduce and fix.