-
-
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
[suggestion] be able to preselect the first exact match #1703
Comments
See my previous response to the suggestion: #1296 (comment). And also #395. The point is, making fzf a fully-featured building block for terminal applications was never a goal to me. Even though there are ambitious users who try to implement all kinds of things with fzf, I'd like to keep fzf conceptually simple and small; an interactive Unix filter. It's not clear to me what you're trying to achieve here (dynamically changing the preview command?), but I'd consider rearranging the order of input lines before feeding it to fzf, i.e. feed "preselected" entry as the first line. Or you could provide fzf --bind 'ctrl-h:execute:less {} < /dev/tty > /dev/tty' |
Yes, I get your idea of simplicity over feature-complete for fzf. This is one of the reason this tool is so powerful.
I'm trying exactly that. To give a bit more context, it's about building a fuzzy file explorer. We are discussing it here : #1679 In fact, in my use case, I need to pass a variable to the preview command for it to change. Given that the preview command looks like a black box, the easiest way to achieve that is to restart fzf with a preview command changed slightly.
I tried that, but it is not satisfactory for me. keeping the cursor position is important, as you have similar enough entry around the one selected. Now, the way I implemented it is a bit different from the way I asked for it. I don't select the first match of a string, but I select an entry at a particular index. I'll make a PR, just so that we can discuss this a bit further if you'd like: if it's simple enough for you or if you see some corner cases not covered by my implementation. This change is just a few lines long, so I don't think it introduces a lot of new code complexity. For my specific use case, see here: https://github.com/FractalWire/fexp |
In a scripting perspective, I'm trying to preselect an entry on fzf when it starts.
That selection might be different from the
--query
option.This option would allow fzf to keep context between two calls and could be called
--selection
for example.Here a typical use case:
Currently, the only way to pre-select an entry is to modify the query with the exact match. By doing that we lose the context of fzf, as both the query and the selection might matter.
The text was updated successfully, but these errors were encountered: