Parse Error Near `]' In When Trying To Update Zshell Prompt

- 1 answer

I'm trying to update my OSX (Monterey 12.1) zshell prompt to include the current Git branch and status. I've copied the latest from GitHub (this one) to ~/

I have the following barebones file at ~/.zshrc per the documentation:

source ~/
setopt PROMPT_SUBST ; PS1='[%[email protected]%m %c$(__git_ps1 " (%s)")]\$ '

When I start a terminal window, I get an error stating there's a "parse error near ']'" on line 318:

Last login: Tue Feb  1 14:06:54 on ttys000
/Users/<user>/ parse error near `]'
zsh: command not found: __git_ps1                                                                                       
[<user>@<machine> ~]$ 

Am I somehow doing something incorrectly here? It looks like hasn't been changed in a while, so I assume it's stable.



As correctly speculated in the comments above, the version of I was using had its tabs replaced with spaces (by my IDE), making parts of the script not get parsed as intended. Copying it from the source into a different text editor that didn't change whitespace resulted in everything working correctly.