junegunn / fzf

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

Add the environment variable FZF_PREVIEW_LABEL #3693

Closed Phantas0s closed 5 months ago

Phantas0s commented 5 months ago

The new environment variable FZF_PREVIEW_LABEL get the value of the preview label, even if it has been updated with an action. It can be useful to track the label of the preview and be able to switch between previews using only one binding.

For example:

  --bind='ctrl-p:transform:[[ $FZF_PREVIEW_LABEL =~ 'status' ]] \
    && echo "change-preview(git diff)+change-preview-label([[ diff ]])" \
    || echo "change-preview(git status)+change-preview-label([[ status ]])"' \
junegunn commented 5 months ago

Merged, thanks!