oh-my-zsh error after upgrade: ~/.oh-my-zsh/lib/misc.zsh:3: parse error near `then'

7.1k views Asked by At

today I upgrade my oh-my-zsh and then start this error: ~/.oh-my-zsh/lib/misc.zsh:3: parse error near `then'

Inside this file there is this shell loop...

## Load smart urls if available
for d in $fpath; do
    if [[ -e "$url/d-quote-magic"]]; then                                                                                                 
        autoload -U url-quote-magic
        zle -N self-insert url-quote-magic
    fi
done

I think the problem it's inside the if condition, but I don't have shell/zsh skills :( Could anyone can help me with this? Thanks a lot! :)

3

There are 3 answers

1
Tong On BEST ANSWER

Use upgrade_oh_my_zsh upgrade to the latest version.

This issue fix here

0
Thiago Medeiros On

Etan Reisner help me out with his commentary. You need a space between the " and the ]] in that if line.

So I just add a space :') and fix the warning! :P

for d in $fpath; do
    if [[ -e "$url/d-quote-magic" ]]; then                                                                                                 
        autoload -U url-quote-magic
        zle -N self-insert url-quote-magic
    fi
done

Thanks again! :)

0
tasmo On

According to their Wiki on GitHub it is possible to overwrite internal lib/*.zsh files through creating a corresponding $ZSH_CUSTOM/lib/*.zsh:

It's not documented in the Customization page, but $ZSH_CUSTOM/lib/*.zsh do override the corresponding internals lib files. If a custom one is present, it is sourced instead of the one in the distribution.