zoxide icon indicating copy to clipboard operation
zoxide copied to clipboard

Unable to initialize zoxide in my zsh

Open moheladwy opened this issue 10 months ago • 3 comments

I put this command eval "$(zoxide init zsh)" in my .zshrc at the bottom of the file as the README said, When I open the terminal I got this error "(eval):51: parse error near `}" at the startup of the terminal, I run the command and exported in an external file and then opened it, I found out that the problem with the function __zoxide_z(), the line 51 was the } at the end of the this function.

function __zoxide_z()  {
    # shellcheck disable=SC2199
    if [[ "$#" -eq 0 ]]; then
        __zoxide_cd ~
    elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then
        __zoxide_cd "$1"
    else
        \builtin local result
        # shellcheck disable=SC2312
        result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" && __zoxide_cd "${result}"
    fi
}

i don't know what is the problem with this function actually. How can I solve this problem?

moheladwy avatar Apr 19 '24 13:04 moheladwy

What version of zsh are you using? You might need to upgrade it.

zsh --version

ajeetdsouza avatar May 05 '24 14:05 ajeetdsouza

@ajeetdsouza The Version of the zsh on my system (arch-linux) is 5.9

image

moheladwy avatar May 06 '24 01:05 moheladwy

Same problem here 👋

zsh 5.9 (arm-apple-darwin21.3.0)
zoxide 0.9.4

rafaell-lycan avatar Aug 20 '24 14:08 rafaell-lycan

I'm not able to reproduce this, it feels like it may be specific to your configuration. Could you try deleting one line at a time and seeing where the offending line is?

ajeetdsouza avatar Sep 12 '24 19:09 ajeetdsouza