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

Real-time filter current directory #137

Closed
musjj opened this issue Sep 12, 2023 · 12 comments
Closed

Real-time filter current directory #137

musjj opened this issue Sep 12, 2023 · 12 comments
Labels
waiting on op Waiting for more information from the original poster

Comments

@musjj
Copy link
Contributor

musjj commented Sep 12, 2023

ranger, nnn and lf allows you to filter the current directory.

yazi already allows you to perform a recursive search using fd, but sometimes you just want to search for files within the current directory in real-time (search results are shown on every keypress, instantly).

@sxyazi
Copy link
Owner

sxyazi commented Sep 12, 2023

I think #104 is what you expected, it was just merged 20 hours ago, you can build from source to experience it in advance!

@musjj
Copy link
Contributor Author

musjj commented Sep 12, 2023

Thank you, it seems pretty close to what I want! But it'd be nice if it can also narrow down the search results, similar to / within the ? help menu.

@sxyazi
Copy link
Owner

sxyazi commented Sep 12, 2023

But it'd be nice if it can also narrow down the search results, similar to / within the ? help menu.

This seems to be a duplication of the search (note, not find) feature.

It searches for specific files and only displays matches. What you might be looking for is a feature to search within the current directory without recursion. I have plans to add this, but currently don't have enough time, of course, PR welcome.

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Sep 12, 2023
@musjj
Copy link
Contributor Author

musjj commented Sep 13, 2023

Hmm, I'm not really sure if this should be a part of of a search option. A real-time filter have to update for every key-stroke, so wouldn't it be a bit slow since search needs to spawn fd every time? I feel that find is a better fit for this feature.

@sxyazi
Copy link
Owner

sxyazi commented Sep 13, 2023

This is a challenge for large directories IMO, because it involves matching all files in the entire directory with every keystroke and then relaying out the Vec, which requires a lot of memory movement.

The current implementation of "Find" keeps the file list read-only and only checks and jumps to the first matching item. "Search" seems more suitable for such scenarios, even though it's not triggered with every keystroke.

@musjj
Copy link
Contributor Author

musjj commented Sep 13, 2023

How does fzf handle it? fzf feels pretty fast for me. There's also https://github.com/lotabout/skim, a fzf alternative written in Rust that provides a library.

@sxyazi
Copy link
Owner

sxyazi commented Sep 13, 2023

It seems like fzf may use multi-threading to speed up matching -- I'm not very familiar with the specific details of fzf. However, Yazi has already integrated fzf, so you can see if it meets your needs.

Also, are there any other terminal file managers that have smoothly implemented this feature? I could use that as a reference. I've previously tried ranger's filtering feature, but it performed poorly with large directories (100,000 files) and was frustratingly slow.

@musjj
Copy link
Contributor Author

musjj commented Sep 13, 2023

nnn and lf implements this feature. With nnn you can just use the / command. For lf, put set incfilter in ~/.config/lf/lfrc and run the :filter command. From my experience, the speed is pretty acceptable.

@sxyazi
Copy link
Owner

sxyazi commented Sep 13, 2023

Okay, add it to the Feature Request and find time to implement it

@sxyazi sxyazi mentioned this issue Sep 13, 2023
59 tasks
@sxyazi
Copy link
Owner

sxyazi commented Sep 13, 2023

Added, closing this issue in favor of the Feature Requests list

@sxyazi sxyazi closed this as completed Sep 13, 2023
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 27, 2023
@sxyazi
Copy link
Owner

sxyazi commented Dec 27, 2023

Hey @musjj, your feature request of "Filter files in real-time" has been implemented in #454 by @Rolv-Apneseth.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
waiting on op Waiting for more information from the original poster
Projects
None yet
Development

No branches or pull requests

2 participants