-
Notifications
You must be signed in to change notification settings - Fork 19
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
Limit search by delimiter (e.g. slashes between directories) #11
Comments
I just released zf 0.6.0 (updates to using zf as a library) and am now looking into implementing this. Here's some of my thoughts The current function scans byte-by-byte for each token, and already stores state like whether or not the last match was a sequential character. I think this feature would work like this
so with query
I will experiment with this next week. I'm excited for this feature, and I think it complements zf's focus on filename matching. Thanks for the suggestion! |
I really like this suggestion. Typing a This reminds me of the excellent Example of smartcase:
|
@ratfactor thanks for calling out the intent here. That's an excellent way of describing it! I really want to add this now, but adding unicode support will require changing some of the fuzzy finding algorithm, so I want to do that first. |
@Pistos I implemented this feature today and I have it in a feature branch. It was about as straightforward as I expected which makes me think I might have not considered all cases. But tests are passing so maybe its good! Do you want to test it and give feedback? The branch is If you don't have a zig dev environment set up I can compile an executable for you if you want. I also wouldn't be against any feedback from @ratfactor either! |
Oh my gosh, it's amazing! 😲 I understood what this was going to be in theory...but it's even better than I would have imagined in practice. Because zf is interactive, once I match a directory, typing I'm switching to this immediately. 😆 |
I love the enthusiasm! I agree, this is much more powerful than I first anticipated. I just released version 0.7.0 with this feature included! Thanks again @Pistos for suggesting it! |
I haven't tried it yet, but I will. Glad I could contribute. |
So I gave this a test drive. Good work. However, I see that it behaves slightly differently than what I'm used to. That's my fault for not being even more specific with my feature request. An addendum (or unwritten test 😉): Given these files:
I would expect that typing
In other words: I don't want to have to know every segment of the dir ancestry of the file I want to get to. If I know I've got a Apply the same concept generally for any arbitrary subdir segments. For example, typing
I guess, programmatically, this means that If you want, I can make a separate github issue for this request. |
It's true that I do get three results rather than your expected two.
But I'm not understanding why
It does for me. Is this not what you're getting?
|
No, I get this:
and
has no matches at all, whether I put a trailing Maybe one of us is not using a binary built from the |
To be clear, here is the tree of the local files I've made for experimenting with:
|
Because, for a search input of If we split the input string into segments delimited by slashes, I want each segment only to match within one level of depth. |
Yup, it was me! I see how I accidentally reverted to a previous And you're right. I get the same results you do. And I agree, the path matching strictness before the slash I typed is exactly what I'd want. But it's too strict after the slash I typed. It's like each slash should "lock" a portion of the path to the left, but still leave the portion to the right for fuzzier matching until the next slash and so on...
Does this sound right and/or make sense? |
@Pistos thanks for taking the time to test and give feedback! Sorry I misunderstood the initial request. My solution worked for your original test case so I went ahead with it. But when testing I had already identified a few cases in which I thought it could work better. I think the changes you are proposing here are really good. But they will be a bit more tricky to implement. I'm going to take some time to make sure I really understand this :) and think of a good way to fit it in the framework of the current matching algorithm.
I'll go ahead and make one. |
I spent a long time looking over this and I think I found a good solution. I wrote (a lot) about it in the new issue: #24 Again, y'all aren't required to, but I would appreciate some feedback! I think my new proposal handles all the cases and I really like its intended behavior. But I'm open to suggestions. |
junegunn/fzf#1706
The text was updated successfully, but these errors were encountered: