Strange Behavior with Prezto themes
Hi,
I follow your example on the home page to setup Prezto.
source /usr/local/share/antigen/antigen.zsh
antigen use prezto
antigen bundle sorin-ionescu/prezto modules/helper # required for Git module
antigen bundle sorin-ionescu/prezto modules/editor
antigen bundle sorin-ionescu/prezto modules/git
antigen bundle sorin-ionescu/prezto modules/prompt
antigen theme sorin
But instead of got the wanted prompt, I got :
$fg[cyan]~$(git_prompt_info) $fg_bold[green]❯$reset_color ${return_status}$(git_prompt_status)$reset_color
The colors and functions aren't interpreted. I search for similar issues in the repository and found the #108, but this doesn't help so much If i load a oh-my-zsh theme, everything seems ok.
I try to use the prezto way to choose my theme :
zstyle ':prezto:module:prompt' theme 'name'
This works better but isn't a success : I got the >>> in the right colors, but without the pwd and with an error message on each cd :
prompt_sorin_precmd:5: permission denied: promptpwd
Antigen version is 2.1.0 (Installed with brew) ZSH version is 5.3.1 OS: macOS Sierra Terminal : iTerm2 Build 3.0.15 (but have the same issue with original terminal)
I'm gonna take a look. I believe there's a missing promptinit somewhere.
Thanks for reporting.
I found that adding setopt prompt_subst before sourcing antigen.zsh fixes the problem.
I'll check that out! thanks @maximbaz
FYI this issue is not only related to prezto themes (maybe it is related to use prezto?). I switched to spaceship-zsh-theme and I still need to put setopt prompt_subst in my antigenrc.
For spaceship-zsh-theme this is proposed to be fixed in the theme itself: https://github.com/denysdovhan/spaceship-zsh-theme/pull/275
Perhaps it's not a problem with antigen, but the problem with other prezto prompts and each of them needs to be fixed accordingly.
/cc @belak who might want to add some details.
Ok, I've just taken a look at this (Just got back from a vacation) and there are two ways I could see fixing this: set prompt_subst in antigen's theme loading (though this has the potential to introduce the pw3nage issue into any prompt where that isn't supported to be set), or have it fixed in any themes (this is probably the better solution).
This doesn't show up in OMZ because it sets prompt_subst manually in https://github.com/robbyrussell/oh-my-zsh/blob/0b340bc3a5c58609a07987b296f773eaea17b274/lib/theme-and-appearance.zsh#L44 (loaded from https://github.com/robbyrussell/oh-my-zsh/blob/0b340bc3a5c58609a07987b296f773eaea17b274/oh-my-zsh.sh#L31). It also defines a non-standard way of applying themes, choosing to simply source the files rather than use the prompt function (which loads x_prompt_setup functions)
https://github.com/denysdovhan/spaceship-zsh-theme/pull/275 is my recommended way of fixing the issue. It works with OMZ's prompt loading and it works with the standard prompt loading (and in extension, prezto's prompt module).
Not a solution but we may add a note/troubleshoot section about missing setopt promptsubst option.
Not a solution but we may add a note/troubleshoot section about missing
setopt promptsubstoption.
This seems like a reasonable stopgap :)