[Feature request] Possibility to set up padding for icons
Hi there!
I've found that some icons that I set have double-width (and it is recognized by terminal, and some - does not). It leads to the different visual padding between icons and filenames.
As workaround, I can set another "custom" icons in nvim-tree (like "default-file", or "empty-folder") to "<icon_character>nvim-tree takes from devicons.nvim (they always have padding of one space between icon and filename. And the only way I see to handle that - is to manually redefine each icon as "
i'm currently rewriting the renderer, i think this might be feasible, but not per icon, globally only.
but not per icon, globally only. Well, "global only" is useful too, but not having possibility to set per-icon padding will not solve the situation in first post: some icons (say, the ones I set for folders) have double width, and some - single-char width. So, they got different padding:

here,
- blue folder icons have long padding by themselves because this icon taken from the font with coloured glyphs (not sure what font exactly, tho), and this icon is double-width there.
- "green" folder icons are set as
"<icon><space>"to get proper indentation with "blue" glyphs (otherwise they have same 1-space padding as files). - file icons are not redefined, so they got 1-space padding
by the way, I thought I already posted that in some another issue, but can find it. So, I'll try to repeat here: Since some time (currently I have no way to bisect) NvimTreeFolderIcon highlight group stopped to work. I mean, I can set colors (and other effects) using NvimTree*Name hl-groups, but anything I set for NvimTreeFolderIcon group doesn't apply at all:

(as you can see, neither of icons are colorized as per hl-group)
Maybe a better way would be to detect if the icon is going to be rendered as double-width ? I'm not sure if this is feasible because it might depend on the terminal.
Yeah, I'm also not sure if it is possible to know whether icon will be rendered as double-width, or not.
Although...

But anyway, I personally see the following idea as easier way to deal with the issue (although a bit kludgy, but should work, IMO):
- add option like
g.nvim_tree_icons.padding = (number)where user can specify a count of spaces as padding between icons and text. - only apply it to icons that weren't redefined with
g.nvim_tree_icons.<type>. So, if users redefine the icon, they can add as much spaces as needed to equalize padding with others.
I really think this could be done manually by the user by overriding the default icon in this case. Or nvim-web-devicon's icons. Otherwise i'll provide a global padding option for icons for sure, when i have some time.
Implemented via #1505