Right now you have to pipe to fzf, and as you type fzf will filter the lines based on the text therein.
After reading this I've thought that it'd be really cool to add a flag to specify a query, which will allow fzf to be used without a pipe.
It might seem initially as an equal, albeit weirder, way to rephrase the usage of fzf (since command | fzf is equal to `fzf --query="command"). But this will allow for the query to change as you type to fzf!
A specifically interesting use-case:
fzf --query="git log -S{}" --preview="git show ..."
As you type, you will see the result of a git pickaxe search (looking for a commit containing a certain word [in the diff]), while the preview shows the hunk containing the change.
I believe adding that option would allow even for the development of tools with awesome interactivity.
What do you think?
edit: rephrasing
As of 0.19.0, your use case is possible via --bind=change:reload:.... See also https://github.com/junegunn/fzf/issues/1750. So
git log --color=always --pretty=oneline --no-abbrev-commit --decorate \
| fzf --phony --bind="change:reload:git log -G{q} --color=always --pretty=oneline --no-abbrev-commit --decorate" \
--preview="git show --color=always {1}" \
--preview-window right:80% \
--with-nth=2.. --layout=reverse --no-sort --ansi \
| awk '{print $1}'
Replace -G with -S if you prefer the pickaxe behavior.
Most helpful comment
As of 0.19.0, your use case is possible via
--bind=change:reload:.... See also https://github.com/junegunn/fzf/issues/1750. SoReplace
-Gwith-Sif you prefer the pickaxe behavior.