nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua
Other
6.79k stars 603 forks source link

Set folder icon depending on it's name #902

Open melsiir opened 2 years ago

melsiir commented 2 years ago

Is there any way to set icon for folder depending on it's name that will be very useful like in vs code ٢٠٢٢٠١١٩_١٦٣٠٥٩

kyazdani42 commented 2 years ago

this would be interesting indeed :) But not feasible atm, i'll see when refactoring the renderer.

kyazdani42 commented 2 years ago

just a side note: vscode renders svg which is not feasible in nvim-tree since a terminal renders unicode and not images.

kraftwerk28 commented 2 years ago

@kyazdani42, nerdfont patch has various directory icons and lsd uses them. Though it is probably web-devicons task to resolve the icon depending on directory name.

alex-courtis commented 1 year ago

Larger issue #1508 should cover this one, with an icon applied to the path regex.

siduck commented 10 months ago

has anyone managed to get this work?

alex-courtis commented 10 months ago

This can be done, using a regex to apply:

Pull Requests are always gratefully appreciated.

yesidrs commented 3 months ago

So there is already a way to implement it or not yet? I am a little bit confused with the different open issues about this same topic and their answers. I think that the mere fact of being able to change the color of the folder according to its regex would be more than enough to differentiate the purpose of specific folders.

alex-courtis commented 3 months ago

The highlighting and most of the renderer was recently rewritten: #2455

This funtionality should be easier to implement: implement a new Decorator for user highlights, say, DecoratorUser.

That new decorator could read some new options and apply them to icon and file names. It might be easier for the user to supply functions instead of using regexes.

See https://github.com/nvim-tree/nvim-tree.lua/issues/1508#issuecomment-1938041465