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

FEATURE REQUEST: Ability for zi to go directly to single result #997

Open
jasonlyle88 opened this issue Feb 23, 2025 · 3 comments
Open

FEATURE REQUEST: Ability for zi to go directly to single result #997

jasonlyle88 opened this issue Feb 23, 2025 · 3 comments

Comments

@jasonlyle88
Copy link

If zi comes up with only 1 result, it would be nice if we were able to configure it so that it could automatically go directly to that result! Maybe an environment variable that could be set?

@azaleacolburn
Copy link
Contributor

azaleacolburn commented Mar 21, 2025

I'm not sure if this is exactly the functionality we want, but assuming I'll assume it is. This might be kinda weird because you'd have to get the length of a stream, but it's totally possible and pretty easy.

@jasonlyle88
Copy link
Author

That's why I said it should be a configurable option. I do t want to go changing the default behavior that everyone has come to expect from zi. So by default, zi would still behave the same. But if we set this new environment variable (_ZO_ZI_GO_TO_ONLY_RESULT=true or something like that?), then this new behavior would be enabled.

When I originally picked up zoxide, I had considered aliasing cd to zi... But quickly decided against it when I discovered that there was no way to make zi go to a single result.

This feature makes that more of a possibility. Maybe still not a great option, but it makes it more realistic at least!

@azaleacolburn
Copy link
Contributor

azaleacolburn commented Mar 24, 2025

The PR #1026 will create an environment variable that allows additional options to be passed into fzf when running zi. Once that PR is merged, you'll be able to set the behavior you've detailed with:

export _ZO_FZF_EXTRA_OPTS="--select-1"

Note

The exact environment variable name might change, so be sure to check the docs after the PR is merged.

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

No branches or pull requests

2 participants