Skip to content
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

fix node style with no LS_COLORS set #656

Closed
wants to merge 2 commits into from
Closed

Conversation

Locorock
Copy link

Fixing the issue mentioned #651
Instead of calling for default() on LsColors it calls on empty() in order to avoid injecting a default style
Tested with and without LS_COLORS set and it seems to do the trick

@Locorock
Copy link
Author

Actually hold up, i'm still getting some issues with the default config, i'm going to need to test this one a bit more

@Locorock
Copy link
Author

I'm giving priority to config defined styles and falling back to ls_colors if they are not defined for an element, not sure if that is the intended behavior, i'm going to need some input here

@sayanarijit
Copy link
Owner

Sorry, I haven't been able to review this. I'll do it soon.

For now take a look at these for the intended behaviour:

@Locorock
Copy link
Author

Locorock commented Jul 20, 2023

So, from what i understand the priority should be like this:
Specific Node Style (mimetype, extension, special) > LS_COLORS > Generic Node Style (file, table, tree, etc...)

Instead of right now:
LS_COLORS > Specific Node Style > Generic Node Style

But the lua implementation only allows the current implementation OR the opposite:
Specific Node Style > Generic Node Style > LS_COLORS
Because we get meta_style which is the style from config (specific and generic already mixed) and ls_style which is from LS_COLORS

@sayanarijit
Copy link
Owner

sayanarijit commented Jul 21, 2023

Damn, it's getting complex 😅 ... I need some more time to remember and document things (as I'm sure I'll forget it again).

But as of now, IMO, the priority should be:

xplr.config.node_types (it's empty by default) > $LS_COLORS.

If $LS_COLORS is unset i.e. LS_COLORS= xplr, xplr will copy the behavior of ls, i.e. default to a stock $LS_COLORS.

xplr.config.node_types prioritizes specific over generic, and the final value can be obtained dynamically by xplr.util.node_type.

i.e. specific xplr.config.node_types > generic xplr.config.node_types > $LS_COLORS

So, $LS_COLORS is the most generic, because it applies across different tools.

Note that this isn't the case for master main branch. The dev branch should have the correct behavior though, but I need to check again.

@sayanarijit
Copy link
Owner

But I guess it makes sense to be able to ignore $LS_COLORS completely. Maybe ls is wrong, and we can treat empty as actually empty, rather than default.

Another option is to treat unset and "" differently, but that'll probably add more confusion.

Another option is to add xplr.config.general.disable_ls_colors, which would be ideal, but feels a bit of overkill.

@sayanarijit
Copy link
Owner

Closing this as the intended behaviour is to prioritize init.lua over LS_COLORS.

@sayanarijit sayanarijit closed this Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants