zsh agnoster theme chagne prompt/ps1

Viewed 6652

How can I change the prompt of my zsh shell while still retaining the cool coloring that agnoster provides? For people who don't know, it looks like this enter image description here I want to add some things like ! and \u before the working directories. I've tried the usual PS1="! \u \w" but it just gives this: enter image description here

EDIT: I found the right escaped characters for inserting information, but it cancels out the styling enter image description here How can I change the prompt while maintaining the styling?

2 Answers

You can change the prompt_context() in .oh-my-zsh/themes/.zsh-theme with the following block of code

prompt_context() {
     if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
         prompt_segment black default "%(!.%{%F{yellow}%}.)~"
     fi
}
Related