Exa: Refactoring of icons

Created on 3 Aug 2019  ·  4Comments  ·  Source: ogham/exa

I think it would be good to refactor icons.rs.
I suggest moving all icons declaration to another plain or simple file to make it easier to add new file types.
Another featureis to add differect icons for different folders, e.g. node_modules,bower_components, site-packages.

Most helpful comment

Or will be better to parse an env variable, for example, LS_ICONS in the following format:

LS_ICONS="*.rb=e21e:*.vim=e62b:*.sh=f292:"

similar to LS_COLORS.

All 4 comments

Or will be better to parse an env variable, for example, LS_ICONS in the following format:

LS_ICONS="*.rb=e21e:*.vim=e62b:*.sh=f292:"

similar to LS_COLORS.

@ogham What about this?

Or will be better to parse an env variable, for example, LS_ICONS in the following format:

LS_ICONS="*.rb=e21e:*.vim=e62b:*.sh=f292:"

similar to LS_COLORS.

This idea is pretty good, I'd recommend adding the following concepts:

  • LS_MIMETYPES to map keys of mime filetypes to unicode code points
  • LS_EXT2MIME to map a comma separate list of extensions to a mime type

Example:

LS_MIMETYPES="application/octet-stream=\Uf471;application/gzip=\U15FDC:application/*=📦:image/png=\U1F3A8\e01;35m:image/*=\e38;5;97m🖼️"
LS_EXT2MIME="png,jpg,gif=image/*;tar.gz=application/*"

This allows exa to be extended using mime type file categorization or by file extension. The LS_MIMETYPES is a list of mimetype keys that support wildcards e.g. image/, audio/, video/*. It can act as an override of LS_COLORS in that it allows a user to define unicode escapes \UXXXX, directly paste unicode characters, and specify SGR escapes.

By using file magic mime type analysis, users would not be required to maintain a LS_EXT2MIME variable or set LS_COLORS. To avoid the performance hit, users could define LS_EXT2MIME for forced mapping of file extensions to mimetypes.

@pagerc I think this is very complicated. In any case, this project is developing very slowly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anishmittal2020 picture anishmittal2020  ·  5Comments

lilianmoraru picture lilianmoraru  ·  5Comments

wkschwartz picture wkschwartz  ·  6Comments

huxi picture huxi  ·  3Comments

CosmicToast picture CosmicToast  ·  4Comments