-
Notifications
You must be signed in to change notification settings - Fork 183
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
Question: is intended behavior to return custom icon only on exact match? #84
Comments
This was intended behavior. I wrote this plugin to solve performance issues in my tree regarding vim-devicons, but my tree only needs to pass the filename as it is so it does not really matter to me. |
@saviocmc Do you know if your solution was adopted by Telescope team? |
@gegoune Yes, it was! Telescope now uses only the file name (not the complete file path, as before) to call this plugins, this way the icons are always consistent. This issue can be closed. Sorry for the delay, appreciate your work. |
For future reference, here is the helper function that seems to do the trick: Perhaps it could be added to this plugin as an input sanitization step if it proves not to be a significant performance hit. |
That's is a good news, thank you for getting back to us! |
@alex-courtis Wouldn't #84 (comment) solve regex issues? |
We could add an option like the very recently added strict https://github.com/nvim-tree/nvim-web-devicons#get-icon I'm very hesitant to make any changes that might break existing behaviour, as the blast radius for this plugin is very large. |
There are some file names that have special icons, different for the icon related to the file extension.
Example: the
.gitlab-ci.yml
has its own icon, which is different from the icon for other.yml
files.That's great! But the custom icon is only returned if I call the
get_icon
function with the exact filename. If the special file is under another path, the default icon is returned:If call
:lua print(require('nvim-web-devicons').get_icon('.gitlab-ci.yml'))
I get the special gitlab icon. (Great!)But if I call
:lua print(require('nvim-web-devicons').get_icon('otherdir/.gitlab-ci.yml'))
I get default.yml
icon.The same happens if I define some special icon by myself, like
package.json
or.eslintrc.js
.This can be resolved by using the function
vim.fn.fnamemodify
with the flag ':t' to provideget_icon
only the tail of the file path.I would like to know if this is the intended behavior. If it is, I think a tip could be added to the README instructing the user about using
vim.fn.fnamemodify
to not miss the special icons.I notice that using telescope.nvim. With the fuzzy finder, the special icons are rendered only if the file is in the vim current directory, otherwise the 'defaults' icons are displayed. I just want to check with you before submitting a PR to telescope about using
vim.fn.fnamemodify
to avoid this inconsistency.The text was updated successfully, but these errors were encountered: