junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
64.25k stars 2.38k forks source link

Re-evaluate --bind each time bindkey pressed #3896

Closed tmpm697 closed 3 months ago

tmpm697 commented 3 months ago

Checklist

Output of fzf --version

0.53.0

OS

Shell

Problem / Steps to reproduce

take below example:

export test=true
fd --type file |
  fzf --bind 'ctrl-t:transform:[[ $test ]] &&
              echo "execute(echo hehe >./hehe; export test=false)+transform-query(echo $test)" ||
              echo "execute(echo kaka >./hehe; export test=true)+transform-query(echo $test)"'

press ctrl-t will always change query to true, but expect true or false between each press.

here the whole text after --bind and in single quote evaluate only one time so $test always true and somehow export test=false didn't work

expect something we can dynamically update query with fzf each time press keys, not just one.

junegunn commented 3 months ago

See #2976 #2299

Also related: https://github.com/junegunn/fzf/pull/3593/files