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

Configurable file sorting #4070

Open
adamsmd opened this issue Nov 22, 2024 · 1 comment
Open

Configurable file sorting #4070

adamsmd opened this issue Nov 22, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@adamsmd
Copy link

adamsmd commented Nov 22, 2024

Is your feature request related to a problem? Please describe.

LazyGit currently orders items in the Files pane in a directory-first, uppercase-first ordering. My other applications (ls, VSCode, etc.) mix files and directories as well as upper and lower case. Aside from my preference for mixed orders because they keep files next to similarly named folders, this difference between applications creates a mental overhead when a file appears, for example, early in the ordering of those apps but late in the ordering used by LazyGit. Thus, to reduce mental overhead and improve my flow, I'd like the ability to configure the ordering that LazyGit uses for the Files pane, so I can make it consistent with my other applications.

For example, the current ordering is:

  • G/
  • H/
  • e/
  • f/
  • C
  • D
  • a
  • b
  • j

What I would like is:

  • a
  • b
  • C
  • D
  • e/
  • f/
  • G/
  • H/
  • j

Obviously, whether to mix files and directories as well as whether to mix cases is a personal preference, so I am not advocating for a change to a particular default, just the ability to configure it.

Describe the solution you'd like
I'd like a configuration option to control or ordering of items in the Files pane. For example, something like VSCode's "Explorer: Sort Order" and "Explorer: Sort Order Lexicographic Options".

@adamsmd adamsmd added the enhancement New feature or request label Nov 22, 2024
@stefanhaller
Copy link
Collaborator

I support this. I'm not totally sure it has to be configurable though; a good first step would be to show items in the same order as git status and git diff do (which is mixed files/directories, but case sensitive though). Rationale: I often look at the diff of a commit, with this table of contents at the top, right after the commit message, and when I hit enter to look at the changed files I see them in a different order. I find this confusing.

In addition to that, we might consider adding config options as you suggest. This is a tiny little bit more work because we need to pass those options from where the UserConfig is known, down to where they are needed (the code is here). Not terribly hard.

As for which exact options we should use: I feel we don't need the full flexibility of VSCode, a simple case sensitivity bool and mix files/folders bool would be enough.

@adamsmd Feel like giving this a try yourself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants