ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
22.12k stars 537 forks source link

zsh: use functions instead of aliases for `z` #684

Closed jyn514 closed 7 months ago

jyn514 commented 7 months ago

currently, zoxide init zsh outputs something like this:

$ zoxide init zsh | tail     
\builtin alias z=__zoxide_z
\builtin alias zi=__zoxide_zi

that prevents defining shell functions that call z:

$ cd() { z "$@" && status; }
$ cd ~
cd: command not found: z

instead i have to use __zoxide_z in the function, breaking the facade. it would be nice to output a function directly so i don't have to depend on zoxide's internals.

xfzv commented 7 months ago

Maybe this can be closed now that 0.9.4 defines z and zi as functions instead of aliases?

% zoxide --version
zoxide 0.9.4

% which z
z () {
    __zoxide_z "$@"
}

% which zi
zi () {
    __zoxide_zi "$@"
}
ajeetdsouza commented 7 months ago

Yeap, I changed it and forgot to update here. Thanks!