-
-
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
[Proposal] "Cursor Hold" expect to trigger after some time without keypresses #1211
Comments
Any progress on this cursorhold feature? |
I'd love to see this feature as well. I actually use fzf in a boot menu for ZFS, and I sorely missed this feature! |
Still hoping for this feature. Just changed one of my own scripts to use fzf instead of simply using |
Possible workaround: Event that is triggered after Example: Provided that the user has selected at least one item and more than 2 seconds have elapsed since the line was focused, all selected items will be printed to the terminal. look foo | fzf \
--listen \
--multi \
--preview-window 0 \
--preview $'
while kill -0 "$PPID"; do
if ((FZF_SELECT_COUNT && SECONDS > 2)); then
curl "localhost:$FZF_PORT" --data "become:cat {+f}"
else
sleep 0.05
fi
done' ![]()
Fancy with 5s timer: look foo | fzf \
--listen \
--multi \
--preview-window 0 \
--prompt "hello world ⧗ >" \
--preview $'
TMAX=5
while kill -0 "$PPID"; do
if ((FZF_SELECT_COUNT && SECONDS > TMAX)); then
curl "localhost:$FZF_PORT" -d "become:cat {+f}"
elif ((FZF_SELECT_COUNT)); then
curl "localhost:$FZF_PORT" -d "change-prompt:${FZF_PROMPT%⧗*}⧗ $((TMAX - SECONDS))s > "
else
curl "localhost:$FZF_PORT" -d "change-prompt:${FZF_PROMPT%⧗*}⧗ > "
sleep 0.2
fi
done' ![]() Footnotes |
I've included a comment a few days ago in #974 , but since that issue is closed, most likely it hadn't got any attention. Since it's a new proposal, I think it fits its own issue.
@junegunn Have you considered the possibility of binding a timeout after a certain length of time is passed without any keypresses, kind of like how
CursorHold
works in Vim?Suppose something like:
--expect=cursorhold
would be triggered after a certain length of time passed.--cursor-hold-timeout=500ms
would specify that amount of time--require-input-before-cursor-hold
would assert the timeout would only happen after some key was pressedWith all of that, it would be possible to implement similar behavior to how interactive selectors work, while keeping fzf a simple filter tool.
Besides, it could also have other uses, such as allowing scripts with timeout "default" options to be built. Kind of like how multi-boot systems work. A screen that allows the user to interact and choose a option, but it he doesn't do anything, it will just pick the default option (note that, for this to work, the
--require-input-before-cursor-hold
wouldn't be used).The text was updated successfully, but these errors were encountered: