-
-
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
New scoring weights should prefer beginning of line words more #2909
Comments
fzf is a general-purpose text filter, so the scoring algorithm isn't specifically designed for file paths. In this particular context, fzf --query=add --height=4 << EOF
rm doc/addendum/patch1
git add somedir/patch1
EOF What I presumed was that file paths with whitespace are not very common.
(EDIT: updated not to include Do you have many files with spaces in their paths? |
Yeah I do have many files with spaces. Makes sense though. So how about this: A special "path" mode for fzf that enables specific path behavior. For example, it would also be useful if files were sorted before folders (since you usually always search for files) |
fzf, being a text filter, does not know which entry is a file or a directory; everything is a text. The user should just feed a list of files excluding directories to fzf. # Only files
fd --type f --strip-cwd-prefix | fzf
Can you post a few screenshots where the scoring algorithm of fzf isn't working as desired? |
I see. The bonus points for the boundary characters are currently hard-coded. Lines 115 to 127 in 779d8e1
But maybe we could consider adding an option to tweak the scores. A workaround for now would be to prefix your query with |
I do not consider this a bug. But I would love the option to disable bonus points for boundary characters. Among other things I use fzf for bash history. There I sometimes find myself in situation where I am looking for command where I remember only part of it. For simple example let's say I have forgot exact name of If I can dream a bit then ability to toggle this boundary bonus points on/off during search session would be amazing. Then I can switch between "prefer older exact matches" and "prefer newer substring matches" live... but feel free to ground me back to earth. |
@james64 Have you tried (dynamically) disabling sort by pressing CTRL-R again when that happens? Still not satisfied with the result? |
@junegunn I have not found this feature so far and ou man yes it helps. Together with using or not using |
Without the option, you may get suboptimal results if you have many paths with spaces in their names. e.g. #2909 (comment) Close #3433
man fzf
)Info
Problem / Steps to reproduce
As stated in the release notes for 0.32.0, the scoring weights were updated. However, this changed the behavior in previous versions that preferred words at the beginning:
gives:
whereas in previous versions it would be the other way around. I definitely prefer it to match
foo/bar.sh
first. The current behavior makes it a pain to search for files whose names are also part of other files' name, like in the example posted above where I want to search forbar.sh
.Thanks!
The text was updated successfully, but these errors were encountered: