ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
https://crates.io/crates/zoxide
MIT License
23.13k stars 555 forks source link

checking zoxide was initialised - `zoxide status` or env variable!? #923

Closed ocehugo closed 1 month ago

ocehugo commented 1 month ago

Hi, I would like to look before initialising zoxide.

It would be great if, instead of checking the existence of the "z" function, I could ask zoxide itself (zoxide status), or to rely upon a default environmental variable (e.g. ZO_INIT=yes).

Reasons: a. initialise once , b. make this the same task check for different shells.

I wonder what the author's preference is here.

ajeetdsouza commented 1 month ago

You can check for the existence of the __zoxide_z function. This function is always created upon initialization so that people can alias it / wrap it as per their preferences, and it has the same name across all shells.