Skip to content

Conversation

sxyazi
Copy link
Owner

@sxyazi sxyazi commented Oct 13, 2024

Purpose

There has always been a missing feature in Yazi: typing .mp3$ to select all MP3 files.

Some users who migrated from other terminal file managers really miss this feature and have asked me about it several times.

My usual suggestion is to use the filter (by pressing f), type .mp3$, then press <C-a> to select all, and finally Esc to exit.

However, this is not very user-friendly, as it involves extra steps like <C-a> to select all and Esc to restore the file list layout from the "filter view".

Although it's easy to implement this with a plugin by combining those steps, but I believe this is an important feature that Yazi should have built-in.

Unfortunately, I couldn't come up with a better command name than select to support it, which is already in use. So, this PR renames the existing select command to toggle and simplifies it, keeping it available for this new feature added soon in the feature.

⚠️ Breaking changes

Renamed select command to toggle

# keymap.toml
- { on = "<Space>", run = "select --state=none" },
+ { on = "<Space>", run = "toggle" },
# keymap.toml
- { on = "<C-a>", run = "select_all --state=true" },
+ { on = "<C-a>", run = "toggle_all --state=on" },
# keymap.toml
- { on = "<C-r>", run = "select_all --state=none" },
+ { on = "<C-r>", run = "toggle_all" },

The toggle and toggle_all commands both have optional on and off parameters. If they are not provided, the commands simply invert the current state.

Renamed the select component to pick component

Yazi's design philosophy is to use different terms for different things to minimize confusion as much as possible — if the terms are different, they are likely referring to different things, preventing users from associating them as the same.

During the refactoring, I realized that the select component used for "Open with" also shared the term select, this PR renames it to the pick component as well.

# yazi.toml / keymap.toml / theme.toml
- [select]
+ [pick]

@sxyazi sxyazi merged commit 35c3c9e into main Oct 13, 2024
6 checks passed
@sxyazi sxyazi deleted the pr-c89e219d branch October 13, 2024 10:47
@sxyazi sxyazi mentioned this pull request Nov 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant