yazi
yazi copied to clipboard
Expand candidate without closing the completion prompt
Is your feature request related to a problem? Please describe
With the completion menu, you can't expand a candidate without closing the completion or moving into the selected directory. This feels unintuitive compared to the completion methods found in other editors/IDEs.
Will you be willing to contribute this feature?
- [ ] Yes, I will try to implement it
Describe the solution you'd like
We should be able to expand a candidate without closing the window. To make this work, the first candidate should also not be automatically selected (which is the current default behavior).
For example:
/foo|
foobar
foo
foobaz/
We can then press <Tab>
a few times:
/foobar|
> foobar
foo
foobaz/
/foo|
foobar
> foo
foobaz/
/foobaz|
foobar
foo
> foobaz/
Then we can add /
to enter into the subdirectory:
/foobaz/|
child
items
Describe alternatives you've considered
No response
Additional context
No response
I have considered this approach, but it only allows "prefix matching". If there are multiple filenames in the directory with the same prefix, such as Cargo.toml
and Cargo.lock
, users would need to repeatedly switch between them using the <Tab>
key.
If users want to modify the search keyword to make the results more accurate, they would need to cycle back to the first option or use a special "cancel key" to cancel the selection, which adds complexity.
In the current way, we can extend it by implementing fuzzy matching - "ct" matches "Cargo.toml", "cl" matches "Cargo.lock", and users only need to press <Tab>
once.
If there are multiple filenames in the directory with the same prefix, such as
Cargo.toml
andCargo.lock
, users would need to repeatedly switch between them using the<Tab>
key.
I'm not sure what you mean. Isn't this how it currently works (except that the first candidate is automatically selected)?
If users want to modify the search keyword to make the results more accurate, they would need to cycle back to the first option or use a special "cancel key" to cancel the selection, which adds complexity.
If the user wants to make the results more accurate, they can just keep on typing to narrow down the results before cycling through the candidates. That's how I usually do it in other editors. Actually, this also doesn't sound any different from how it currently works, can you clarify?
Fuzzy completion would definitely be an awesome addition though.
Current autocomplete in Yazi is not just "prefix matching". If we implement the issue's approach would lead to:
/go|
Cargo.toml
Cargo.lock
then press <Tab>
:
/Cargo.toml|
> Cargo.toml
Cargo.lock
press <Tab>
/Cargo.lock|
Cargo.toml
> Cargo.lock
press <Tab>
again:
/go|
Cargo.toml
Cargo.lock
It changed from go
to Cargo.toml
, which is quite strange. I haven't seen this behavior in any editor/shell I've used. In contrast, Neovim is like this:
https://github.com/sxyazi/yazi/assets/17523360/cd13a891-412d-4739-af64-b24fddae5251
In zsh like this:
https://github.com/sxyazi/yazi/assets/17523360/c0f2ebcb-1362-43e0-ab22-13be1a97ff99
Their candidates start with ma
or da
that's user input.
It changed from
go
toCargo.toml
, which is quite strange. I haven't seen this behavior in any editor/shell I've used. In contrast, Neovim is like this:
Hmmm, I don't think it's strange. This is how my neovim's nvim-cmp
works (I think it's pretty close to the default):