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

Issue with file extension matching #483

Open
sethen opened this issue Jul 21, 2024 · 6 comments
Open

Issue with file extension matching #483

sethen opened this issue Jul 21, 2024 · 6 comments

Comments

@sethen
Copy link

sethen commented Jul 21, 2024

Looks like nvim-web-devicons gets confused with you use more than one period for the extension in a file name. I would expect it to know that it should apply the same icon to .ts files as it does for test.ts files, but it doesn't. You have to add test.ts to the config or it will not apply. To make it work I have to do something like this:

return {
   'nvim-tree/nvim-web-devicons',
   dependencies = {
      'catppuccin/nvim',
   },
   config = function()
      local icons = require('nvim-web-devicons')
      local palette = require('catppuccin.palettes').get_palette('mocha')

      icons.setup({
         override = {
            ts = {
               color = palette.blue,
               icon = '',
               name = 'Ts',
            },
            ['test.ts'] = {
               color = palette.blue,
               icon = '',
               name = 'Test.ts',
            },
         }
      })
      icons.set_default_icon('')
   end,
}

Here's what it looks like if I would take the test.ts configuration out:
Screenshot from 2024-07-21 00-07-02

@sethen sethen changed the title Issue with matching Issue with file extension matchin Jul 21, 2024
@sethen sethen changed the title Issue with file extension matchin Issue with file extension matching Jul 21, 2024
@hasecilu
Copy link
Collaborator

Are you sure it's a glyph from NF? Seems you're using a faulty codepoint.

@sethen
Copy link
Author

sethen commented Aug 28, 2024

Are you sure it's a glyph from NF? Seems you're using a faulty codepoint.

Guess I don't understand how that would be a faulty codepoint? How does it work with .ts extensions but when test.ts is in the file it doesn't work?

@hasecilu
Copy link
Collaborator

I meant that in your snippet you used codepoint EA55 and in NerdFonts there is no associated glyph. If you got a "square" there it's because there is no glyph there.

I tried replacing the icons and works:

image

@sethen
Copy link
Author

sethen commented Aug 28, 2024

I meant that in your snippet you used codepoint EA55 and in NerdFonts there is no associated glyph. If you got a "square" there it's because there is no glyph there.

I tried replacing the icons and works:

image

You're correct, there is no code point in NerdFonts. I use my own custom icon font and define the codepoints in Kitty (Terminal).

@sethen
Copy link
Author

sethen commented Aug 28, 2024

What you're seeing with the code point (EA55) is the same code point for the .ts files. So I am confused why it won't load the same icon for the same file extension.

@hasecilu
Copy link
Collaborator

I tried changing both extensions to the same char and also works. Not sure what could be happening on your end, maybe using override_by_extension makes a change.

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