Startup error when having `cd` already set as alias
I'm using zoxide which creates an alias for cd
This results in gvm throwing errors on startup of zsh.
/home/adonis/.gvm/scripts/env/cd:46: defining function based on alias `cd'
/home/adonis/.gvm/scripts/env/cd:46: parse error near `()'
did you find a fix for this?
I had this too, and just figured out how to solve it.
So the issue is that you already have an alias named cd. The solution is to either remove that alias, or just run unalias cd before that line. See https://stackoverflow.com/questions/76638009/zsh-script-is-throwing-a-syntax-error-parse-error-near.
Well, now I can't actually use cd at all, as in, when I type cd .. or cd any-dir, I don't actually change directory. FML, I give up.
I've temporarily solved the issue by redirecting all stderr to /dev/null. Just add the following line at the beginning of the script /Users/<user>/.gvm/scripts/env/cd.
exec 2>/dev/null
I solved it by moving this line:
[[ -s "/Users/.../.gvm/scripts/gvm" ]] && source "/Users/.../.gvm/scripts/gvm"
above my alias setup (alias cd="z") in .zshrc
I solved it by moving this line:
[[ -s "/Users/.../.gvm/scripts/gvm" ]] && source "/Users/.../.gvm/scripts/gvm"above my alias setup (
alias cd="z") in.zshrc
I can't use my cd now , I have try your solution, but I stiil can't use my cd. What should I do now?
managed to work around it with
$ tail ~/.zshrc
...
unalias cd
[[ -s "/Users/YOU/.gvm/scripts/gvm" ]] && source "/Users/YOU/.gvm/scripts/gvm"
alias cd='exec_scmb_expand_args builtin cd'
...