devicon-lookup icon indicating copy to clipboard operation
devicon-lookup copied to clipboard

Add ability to configure icons

Open mawkler opened this issue 4 years ago • 3 comments

Hi! It would be nice if devicon-lookup allowed for customization of the icons used for each filetype. Perhaps through a flag or a config file. This would also allow users to add icons to custom filetypes.

mawkler avatar Jun 21 '20 13:06 mawkler

Hey @Melkster thanks for the issue!

That's an interesting idea that I hadn't considered! Do you have any use cases you have in mind that you wouldn't mind sharing? Just curious what you were thinking

It should be possible to add some config that allows for adding custom icons. No promises when I will get to it, but I would gladly review a PR.

I'm currently thinking the best might be a cli option that can be used to specify a file that contains the mappings. Could just do the mappings as cli options too though, I don't know if I have strong feels today

coreyja avatar Jun 23 '20 03:06 coreyja

@coreyja

Do you have any use cases you have in mind

The reason I started thinking of this was because I wanted to change the default icon used in Vim by fzf.devicon.vim for Markdown files to  (U+F136) instead of the default arrow that I don't like.

Also as I mentioned, another use case is if someone would like to define an icon for their own custom filetype.

mawkler avatar Jun 24 '20 21:06 mawkler

@melkster If you're still interested I wrote an awk script as a plugin to nnn that could be used to achieve what you want. See https://github.com/jarun/nnn/pull/927.

Hadn't considered a config file for devicon-lookup although that might have been the smarter option. Only came across this issue after writing the script. Anyways now its just an awk script which is also nice in regards to dependencies. Not sure if it could have been faster in rust but its fast enough. e.g.:

431 directories, 1463 files
tree -L 4  0.01s user 0.00s system 97% cpu 0.011 total
iconlookup  0.01s user 0.00s system 78% cpu 0.021 total

luukvbaal avatar Mar 29 '21 12:03 luukvbaal