nvim-tree / nvim-web-devicons

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

Gemfile ruby icon is not used due to wrong definition #510

Open volodymyr-vt opened 1 week ago

volodymyr-vt commented 1 week ago

image Gemfile ruby icon is not used due to wrong definition "gemfile$" here: https://github.com/nvim-tree/nvim-web-devicons/blob/19d257cf889f79f4022163c3fbb5e08639077bd8/lua/nvim-web-devicons/icons-light.lua#L464C4-L464C14

  ["gemfile$"] = {
    icon = "",
    color = "#701516",
    cterm_color = "52",
    name = "Gemfile",
  },

However if i manually create new definition in my nvim config that uses ["Gemfile"] = { instead of ["gemfile$"] = { it works.

alex-courtis commented 1 week ago

Looking back it appears that this is incorrect. It's trying to use gemfile$ as a regex. Regex matching is not a feature for performance reasons.

Fix 1

File named exactly gemfile will match the ruby icon. It is case insensitive.

vagrantfile$ should also be fixed.

Fix 2

I don't know ruby. Is gemfile used as an extension, something like myproject.gemfile?

If so, we can add that as an extension as well.

volodymyr-vt commented 1 week ago

I don't know ruby. Is gemfile used as an extension, something like myproject.gemfile?

Gemfile is just plain text file with ruby code and name Gemfile. It's the same as Dockerfile.

Hovever Dockerfile defined like this:

 ["Dockerfile"] = {
    icon = "󰡨",
    color = "#2e5f99",
    cterm_color = "25",
    name = "Dockerfile",
  },

So we need to change Gemfile definition to the following:

  ["Gemfile"] = {
    icon = "",
    color = "#701516",
    cterm_color = "52",
    name = "Gemfile",
  },

I can make a PR with fix.

alex-courtis commented 1 week ago

That's right; PR would be most gratefully appreciated.