Skip to content

Provide current item value as environment variable for child processes #4802

Description

@Heck-R

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.72.0 (6fefe02)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

It would be great to have an additional environment variable passed to the child processes, containing the value of the currently selected (/focused?) item.
E.g.: $FZF_CURRENT_ITEM

Motivation

Fzf can do escaping with the {...} style insertions, and I imagine that works great on Linux, however on Windows, cmd is not a great place to be, and powershell requires completely different escaping, for which I did not find any direct solution.
This makes working with complicated item values (such as code, like powershell history attempted to be shown in the preview) quite a hassle on Windows (or at least I did not find any convenient way to handle it)

Funneling values through cmd to powershell or some executable could work, but it could be way easier.
If there were an environment variable, it would easily be usable in any arbitrary shell, without having to worry about escaping

Metadata

Metadata

Assignees

Labels

featureNew feature request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions