antigen icon indicating copy to clipboard operation
antigen copied to clipboard

Strange Behavior with Prezto themes

Open Varkal opened this issue 8 years ago • 8 comments

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)

Varkal avatar May 20 '17 14:05 Varkal

I'm gonna take a look. I believe there's a missing promptinit somewhere.

Thanks for reporting.

desyncr avatar May 20 '17 16:05 desyncr

I found that adding setopt prompt_subst before sourcing antigen.zsh fixes the problem.

max-baz avatar Nov 29 '17 02:11 max-baz

I'll check that out! thanks @maximbaz

desyncr avatar Nov 29 '17 03:11 desyncr

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.

max-baz avatar Dec 03 '17 11:12 max-baz

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.

max-baz avatar Dec 12 '17 14:12 max-baz

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).

belak avatar Jan 08 '18 18:01 belak

Not a solution but we may add a note/troubleshoot section about missing setopt promptsubst option.

desyncr avatar Jan 08 '18 19:01 desyncr

Not a solution but we may add a note/troubleshoot section about missing setopt promptsubst option.

This seems like a reasonable stopgap :)

belak avatar Jan 08 '18 19:01 belak