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

sort_by sort alphabetically but do not take into account beginning dot #2357

Open
2 of 3 tasks
enoryw opened this issue Feb 18, 2025 · 3 comments
Open
2 of 3 tasks

sort_by sort alphabetically but do not take into account beginning dot #2357

enoryw opened this issue Feb 18, 2025 · 3 comments
Labels
feature New feature request waiting on op Waiting for more information from the original poster

Comments

@enoryw
Copy link

enoryw commented Feb 18, 2025

yazi --debug output

N/A

Please describe the problem you're trying to solve

Sorting alphabetically/naturally takes into account the initial dot (hidden files), but an option to also sort alphabetically/naturally ignoring the initial dot is useful. When hidden files are shown, it may be because all files should be treated "equally", so sort all files ignoring the fact that they are hidden.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Maybe rename sort_sensitive to sort_case_sensitive and then provide sort_dot_sensitive option to sort alphabetically/naturally either taking into account dot or not

E.g. sort as (default behavior in nnn file manager):

admin
.android
bin

instead of

.android
admin
bin

Additional context

No response

Checklist

  • I have searched the existing issues/discussions
  • The latest nightly build doesn't already have this feature
@enoryw enoryw added the feature New feature request label Feb 18, 2025
@sxyazi
Copy link
Owner

sxyazi commented Feb 18, 2025

I'm not sure if there's an accurate term to describe this behavior — what's the part that comes right after the initial . in a filename called in Unix? Is there such a concept?

"sort_dot_sensitive" isn't a good name because "dot" doesn't convey that it only applies to files starting with a dot. In most files, the dot is at the end as a separator for file extensions.

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Feb 18, 2025
@enoryw
Copy link
Author

enoryw commented Feb 18, 2025

I guess "sort irrespective of hidden" (applicable to alphabetic and natural sorts only) and an option sort_hidden_sensitive or the more vague sort_smart (as opposed to the other sorts which are more straightforward).

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label Feb 18, 2025
@sxyazi
Copy link
Owner

sxyazi commented Feb 18, 2025

"hidden" doesn't make sense in this context either - you want to change the way the . is handled, but only Unix hidden files start with a ., while Windows defines hidden files based on their file attributes.

Since Yazi is a cross-platform file manager, it's inaccurate to generalize hidden files as those starting with a ..

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request waiting on op Waiting for more information from the original poster
Projects
None yet
Development

No branches or pull requests

2 participants