[Feature request] Repeat the last action command if the action is triggered with empty command
- Dominant language
- Go
- Stars
- 83k
- Forks
- 2.9k
- Avg merge
- 17h 8m
- Merged PRs (30d)
- 10
Description
### Checklist
- [x] I have read through the manual page (`man fzf`)
- [x] I have searched through the existing issues
- [x] For bug reports, I have checked if the bug is reproducible in the latest version of fzf
### Output of `fzf --version`
0.67.0 (b473477c)
### OS
- [x] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.
### Shell
- [x] bash
- [ ] zsh
- [ ] fish
### Problem / Steps to reproduce
Hello,
I propose making actions `reload()` and `transform*()` repeat their last executed command if they are provided with no command at the time of handling new event. Then update of things on the screen will not require specifying commands used for the actions again. This would simplify fzf scripting and make the resulting fzf command much shorter if many bindings are used and/or complicated and long external commands are provided for the actions.
Here is an example where Ctrl-r increments number in the prompt and in the item (note the empty commands used in the 'ctrl-r' binding):
`true | fzf --prompt 0 --bind 'load:unbind(load)+reload(echo "updates: $FZF_PROMPT")+transform-prompt(echo $(($FZF_PROMPT + 1)))' --bind 'ctrl-r:reload()+transform-prompt()'`
Please, have a look at a draft I developed: https://github.com/maxaykin/fzf/commit/7c12f31861e569ac807a85b13b74b7e4738eb2fb
This may be a good addition to #4588 but I believe it is useful by itself as well.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing fzf's action-handling code for reload() and transform*(), then compare the requested behavior with the linked draft commit and the example command. The work is done when empty commands repeat the corresponding last command for new events, while the provided Ctrl-r example continues to update the prompt and item.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100