Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@CatsDeservePets
Copy link
Collaborator

@CatsDeservePets CatsDeservePets commented Nov 3, 2025

This PR aims to align the design of the showbinds menu even further to other terminal file managers. It changes the following:

  • Rename keys to key
  • Omit already typed keys (only in showbinds, maps command still shows the complete key sequence)
lf (old) lf (new) ranger joshuto yazi

@CatsDeservePets CatsDeservePets added this to the r39 milestone Nov 3, 2025
@CatsDeservePets
Copy link
Collaborator Author

Hey @joelim-work.
What are your thoughts on this? This is obviously a breaking change.
I did not ask before hiding the current mode in showbinds as it literally served no purpose (only ever showing current mode; basically fixing something I introduced myself) in #2226 and #2228.

With this one, I would like to hear your thoughts.
I know I can merge changes myself but that doesn't mean I should do so blindly.

Copy link
Collaborator

@joelim-work joelim-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for letting me know about this change.

I think it is not worth making the content of the showbinds menu configurable, and it is better to just provide a fixed implementation that is reasonable (using other file managers as a reference).

The idea of hiding characters that are already typed is fine. I did notice that you only check the first character though, what should the behavior be if the mapping uses more than two characters? What do other file managers do in this case?

map bar echo bar
map baz echo baz

@CatsDeservePets CatsDeservePets marked this pull request as draft November 3, 2025 12:42
@CatsDeservePets
Copy link
Collaborator Author

CatsDeservePets commented Nov 3, 2025

The idea of hiding characters that are already typed is fine. I did notice that you only check the first character though, what should the behavior be if the mapping uses more than two characters? What do other file managers do in this case?

map bar echo bar
map baz echo baz

Oh good point, I did not even consider this.

I created the shortcuts phl and pht (action doesn't matter) in the other 3 file managers.

ranger joshuto yazi

The approach by ranger and joshuto is to one to go here.

Instead of passing a boolean, I might pass ui.keyAcc/nil instead and count the keys. Not sure, if there is a better way than iterating over it keeping track of < and >.

@joelim-work
Copy link
Collaborator

I think it's better to pass in ui.keyAcc and remove the prefix. It might also be worth splitting listBinds into two separate functions if it makes handling the logic easier, since there's a compact form just to help users complete a keybinding.

@CatsDeservePets
Copy link
Collaborator Author

CatsDeservePets commented Nov 6, 2025

Ok, it seems to be more complicated than that.
ranger has this setting:

# The key hint lists up to this size have their sublists expanded.
# Otherwise the submaps are replaced with "...".
set hint_collapse_threshold 10

It only seems to show "..." if the amount of completions exceeds hint_collapse_threshold, otherwise it shows all remaining keys and the full command.

joshuto on the other hand always seems to show only one key at the time while creating submenus with ... until the very last key.

I'd say we just show every remaining key to keep it simple.

@CatsDeservePets CatsDeservePets marked this pull request as ready for review November 7, 2025 01:02
@CatsDeservePets CatsDeservePets changed the title Simplify showbinds menu further Hide already typed keys inside showbinds menu Nov 7, 2025
@CatsDeservePets CatsDeservePets merged commit 0283b2a into gokcehan:master Nov 7, 2025
32 checks passed
@CatsDeservePets CatsDeservePets added the breaking Pull requests that introduce breaking changes label Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Pull requests that introduce breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants