Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'FZF_GLOBAL_POS' environment variable #4078

Closed
wants to merge 3 commits into from

Conversation

jaydee-coder
Copy link
Contributor

@jaydee-coder jaydee-coder commented Nov 4, 2024

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:

  • Added support to the Terminal source file
  • Added tests and man page snippets.

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

@junegunn
Copy link
Owner

junegunn commented Nov 4, 2024

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

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

@jaydee-coder
Copy link
Contributor Author

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
Copy link
Owner

junegunn commented Nov 4, 2024

No problem, thanks for your interest in the project!

@jaydee-coder
Copy link
Contributor Author

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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants