junegunn / fzf

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

Add 'FZF_GLOBAL_POS' environment variable #4078

Closed jaydee-coder closed 3 weeks ago

jaydee-coder commented 3 weeks ago

This env variable can be helpful in a variety of cases for example, for highlighting the original line as part of the preview panel.

The current FZF_POS variable only tracks the index of the selected item as part of the filtered-down list instead of the index in the original list/file. That's why FZF_GLOBAL_POS is added, which adds the ability to track the original index.

Changes:

Please let me know if you have any coding/style feedback especially regarding the global_pos string variable in terminal.go

junegunn commented 3 weeks ago

I believe you can use the existing {n} for that purpose.

seq 10000 | fzf --preview 'echo {n}'
jaydee-coder commented 3 weeks ago

I believe you can use the existing {n} for that purpose.

seq 10000 | fzf --preview 'echo {n}'

dang, I'm such a dummy, you're right, lol! How did I miss it when I used it in the subsequent pull request lol

Thanks for the hint, and closing this useless PR :D

junegunn commented 3 weeks ago

No problem, thanks for your interest in the project!

jaydee-coder commented 3 weeks ago

No problem, thanks for your interest in the project!

The thanks go to you for making such an amazing project!!
It's so well thought-out, so useful, so performant, I have like 20 scripts/on-liners that use it in all my aspects of coding/navigation/searching/etc! The new features too are amazing (multi-line, ansi support, advanced previews, aah so good!)