junegunn / fzf

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

feature: set FZF_SELECTION env var containing text of selected item #3781

Closed kuremu closed 2 months ago

kuremu commented 2 months ago

Sets FZF_SELECTION to the ansi-stripped text of the currently selected item in t.environ(), essentially inserting the value of {} into the environment. If there is nothing in the list, FZF_SELECTION is set to an empty string.

fzf --bind "focus:transform-prompt(echo \${FZF_SELECTION}\>\ )"

This would be useful to me as my reload/transform calls have become pretty complex, and I'm already capturing the other FZF env vars.

junegunn commented 2 months ago

I'm not sure about this (at least not yet). You can already do this with current={}; rest_of_the_command. And by doing this, we're pushing the current item to every child process, whether they need it or not. And in some cases, it can be quite lengthy (e.g. minified JS files, single line of hundreds of KBs), so it might cause some problems.

kuremu commented 2 months ago

I see what you mean, no worries I'll close this for now