zoxide
zoxide copied to clipboard
Unable to initialize zoxide in my zsh
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?
What version of zsh are you using? You might need to upgrade it.
zsh --version
@ajeetdsouza The Version of the zsh on my system (arch-linux) is 5.9
Same problem here 👋
zsh 5.9 (arm-apple-darwin21.3.0)
zoxide 0.9.4
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?