-
-
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
Feature: Set selected entries #395
Comments
I also thought about those stuff, but I felt that maybe I was trying to squeeze too much out of fzf, beyond what it's supposed to do, unnecessarily making it more complex.
It's doable. But I thought it can be very confusing if one of the "pre-selected" items is not listed on the initial page.
It's not as trivial as it seems since fzf works asynchronously. And I suppose you'll end up even wanting to preserve the scrolling offset of the window as well (well, I did). Maybe you could take advantage of I'm not going to rush into a decision, rather I'll leave this issue open and see how the idea develops. |
Yeah, I understand there are some implementation design concerns with both of these, but I'm not sure it would be making "fzf unnecessarily too complex". I think it's more an ideological concern than a technical one(which is fine, fzf is your creation and should follow your ideas). And regarding the cursor position, I think a simple enough and intuitive implementation is:
All these two things add is the ability to restore state upon re-launching fzf, not really introducing any new behaviour as far as I see. The main use case in my opinion is that the user has already built the state previously, so it shouldn't be surprising. |
Well, I said "more complex" not "too complex", so there's difference in nuance :)
Yeah, that's the point I'm not sure about. I'm also not sure if there's a strong demand to use fzf for such purposes. You know, I can't be super motivated to spend my time to implement and maintain esoteric features that only a handful of users will ever use. A broad feature set can intimidate most average users who only need small subsets of it and it usually makes the project less flexible to future changes (if we want to keep backward compatibility).
I personally don't like the suggestions. It's very annoying and confusing for me when my user interface is interfered by some unknown force asynchronously. I would rather block the interface until the item appears. What I meant by scroll offset is that, if the list spans multiple pages, the item can appear on any position on the screen depending on how much you scrolled the list. So that's another missing piece of information when restoring the session. |
Thanks for a good discussion, and I respect your decision :) |
This feature would enable a lot of new use cases.
Selection tool is even more useful when it can come preselected.
Variants:
👍 |
It's not the kind of problem fzf was designed to solve. There are many tools more suitable for the use case such as smenu. |
Hello, I know this is a bit old but I guess it's really important. I haven't gone over the code of fzf yet but I can imagine it would be few lines of code. Here's my proposal; as @haakonstorm mentioned, we can have the When fzf starts, it reads the "preselector" file. The first line is the item pointed to. The rest of the lines are the marked items. When fzf exits, it updates the file based on the last state. For example, if we have this state in fzf:
Then the preselector file content would be:
|
@junegunn it would be nice if there were a "start" or "onload" event. Then users could implement things like this on their own, through the use of actions on startup. |
I use fzf in 16 different commands here https://github.com/nkh/ftl, and I already have this use case for --pre-selection: I use fzf to select multiple elements, some time later I want to deselect some elements and select new elements, all while having the possibility to fuzzy search the elements. |
fzf is absolutely amazing! I would think that such feature could be a nice addition, but I also respect that the main developers on the project have particular preferences! Looking at skim (a rust fzf), it seems that it supports such pre-selection with the |
@tlamadon skim is nice as well. I tried messing around with it before. |
A |
Thanks @Delapouite, that looks promising. |
It would be useful to be able to pass a list of strings that should be selected when launching fzf.
And, related, to pass a string on which the cursor should start. I am currently building https://github.com/ggVGc/fzf_browser and with these options the UI could behave much nicer.
The text was updated successfully, but these errors were encountered: