-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Taking into account the hierarchy of inputs #3255
Comments
Hi @grothesque, Just set Best regards, |
@dr0bz Thanks for the comment. Yes, For But if we add another This feels quite wrong, let me see what I can do. |
@junegunn and @dr0bz, thanks for your suggestions. First, I'd like to comment on the inconsistency noted by @junegunn when using This is with fzf 0.38.0 from Debian. I'm running the command
Without any option, when The Let's say I'm searching the filesystem for stuff that relates to "tinyarray". So I can use the excellent
From the point of view of searching a hierarchical file system, the second match is redundant. Worse, that directory could contain hundreds of files (that may or may not contain tinyarray in their basename). That's why
I would find it extremely useful if there was a way to teach I guess that this would require some special treatment of directory separator characters on the part of fzf. However, I believe that file paths are an important enough application of fzf to justify an exception. |
This bug we discussed above has been fixed in 0.45.0. You are using a very old version of fzf. |
Well, OK, but could you please also have a look at the second (longer) part of my comment where I explain what I actually meant when I opened this issue? |
I feel quite the opposite. I'm usually not looking for intermediate nodes. Anyway, in that case, the default tiebreak of FWIW, you might want to experiment with a patch I posted at #3608 (comment) and see how it works for you. |
Thanks for having a look. The patch you link to looks interesting: perhaps it's possible to implement what I have in mind by assigning a zero (or very low) score to lines whose match does not involve the last path component? (That would rely on the assumption that lines for parent directories are present independently as well.)
Sure, that's a reasonable and consistent design! I find the "prunning" approach very useful when looking for anything related to a person or a project. If there's a directory "Pictures/fred-birthday" that contains 100 files, and I search for "fred", I don't want other results to be overshadowed by the many individual files in that directory. Length as a criterion doesn't really help: There could be a single line that matches as well, but is very long. Still this way of operation may not be very appropriate for fzf: the "prunned" results are a mixture of files and directories, and fzf's main application in my experience is file selection on the command line. Please feel free to close this issue. |
man fzf
)Info
Problem / Steps to reproduce
Many thanks for this excellent tool! After using it for a while and searching the existing issues, I would like to point out a possible direction in which the matching of fzf could be improved.
Like many people, I often use fzf to filter lists of file/directory names. For example, there could be the following directories
When fzf is launched with the above list of choices and the user searches for “foo”, the results will be presented in the above order, i.e. the three subdirectories of
projects/foo
will be considered more relevant than the notes on "foo". However, it could be argued that for a hierarchy of directories and files the subdirectories ofprojects/foo
are already covered by the match of their parent. After all, they do not provide any further reason to match.In the above example with only five items there is no problem, but with thousands of matching items it is easy to miss top-level matches that are shown behind subitems of other top-level matches.
Is there a way to solve this issue by configuration of current fzf? If not, perhaps we could discuss here possible solutions?
The text was updated successfully, but these errors were encountered: