junegunn / fzf

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

Dynamically changing preview label position #3862

Open jdujava opened 2 weeks ago

jdujava commented 2 weeks ago

Checklist

Output of fzf --version

0.53.0 (c4a9ccd6)

OS

Shell

Problem / Steps to reproduce

Is there a way to dynamically change the preview label position? Reading through the documentation I was unable to find something along the lines of change-preview-label-pos action.

Since change-preview-label already is implemented, wouldn't it be more convenient to merge options preview-label and preview-label-pos into one, of the signature along the lines

--preview-label=[N:top|bottom:]LABEL
junegunn commented 2 weeks ago

No. But why would you do that? I can't think of a case where moving the label would benefit the user. Wouldn't it just be confusing?

jdujava commented 2 weeks ago

I am dynamically changing the preview, and I wanted to somehow differentiate between two possible modes. I was considering multiple options:

I also considered that the alternate preview could have different position of label (top vs bottom, left vs center vs right). I wanted to try it out, and thus this feature request.

junegunn commented 2 weeks ago

So it's not something you absolutely need.

Please note that preview/border labels can show ANSI colors, it might help in your case.

fzf --preview 'cat {}' --preview-label $' \x1b[33myellow ' --bind $'space:change-preview-label: \x1b[34mblue '
jdujava commented 2 weeks ago

So it's not something you absolutely need.

Certainly not. Nevertheless, it could be nice to have the option (if someone finds the free time to implement it :).

Please note that preview/border labels can show ANSI colors, it might help in your case.

Thanks for the suggestion!