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

Provide a way to configure where a bare z command goes #805

Closed
pfmoore opened this issue Apr 30, 2024 · 1 comment
Closed

Provide a way to configure where a bare z command goes #805

pfmoore opened this issue Apr 30, 2024 · 1 comment

Comments

@pfmoore
Copy link

pfmoore commented Apr 30, 2024

When I start up a new shell, I have it configured to start in my "scratch" directory, C:\Work\Scratch. Because of this, I think of that directory as my "base location", and as a result it's where I would prefer the z command to take me by default. In contrast, my "home" directory is C:\Users\<myname> and is a place where applications store settings, configuration, etc - but it is not where I routinely store my files and/or projects.

It would be nice to have a way to set an alternative "default location". I guess the way to do this would be via an environment variable, say _ZO_DEFAULT_DIR.

To be clear, I would expect this to only affect the result when running z with no arguments. I don't want it to change the meaning of ~ (which is why I suggested _ZO_DEFAULT_DIR rather than _ZO_HOME).

@ajeetdsouza
Copy link
Owner

zoxide is designed for scriptability, you should be able to add a customization like this very easily. First initialize zoxide without a z command:

eval "$(zoxide init <your shell> --no-cmd)"

Then, you can write a custom function that handles the case with zero arguments, and calls __zoxide_z otherwise.

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