Closed ibhagwan closed 3 months ago
I still don't think it's the right thing to do. fzf is a line filter, and it shouldn't be matching against what's not directly shown on the line. Implementing it properly will add additional complexity (highlighting, horizontal scrolling, scoring, etc) so I don't think it's worth it.
You could maybe repeat the name part again after the directory, maybe in a dimmer color, to allow searching against it.
file.txt foo/bar/file.txt
And then --nth ..,2
to allow anchors on both. ^file.txt
, ^foo
, etc.
I still don't think it's the right thing to do. fzf is a line filter, and it shouldn't be matching against what's not directly shown on the line. Implementing it properly will add additional complexity (highlighting, horizontal scrolling, scoring, etc) so I don't think it's worth it.
You could maybe repeat the name part again after the directory, maybe in a dimmer color, to allow searching against it.
file.txt foo/bar/file.txt
And then
--nth ..,2
to allow anchors on both.^file.txt
,^foo
, etc.
Ty @junegunn for the prompt response and suggestion.
Although I could repeat the filename, that changes the display (undesirable) and probably also has some other unintended consequences for matching that I cannot yet foresee.
Checklist
man fzf
)Output of
fzf --version
0.53
OS
Shell
Problem / Steps to reproduce
Hi again @junegunn.
Ref: #1440
Following on the discussion above, I’d like to consult your opinion about revisiting this.
Use case:
With fzf-lua the users can specify
formatter = path.filename_first
which transforms the path to a VSCode-like style offile.ext path/to/file
, however, as you can imagine this affects the search order so now users can’t search for the path logically (or paste paths) as they have to first write the file and then the folder (or use space in between) - each resulting in additional mental overhead.Consider I wanted to search for my
path/to/fzf/setup.lua
(with the filename first formatter):Tried rearranging the text/fields with both
--with-nth
and--nth
but couldn’t find a way to make it work.