How do I change my $PS1 on a Macbook for oh-my-zsh?
Changing your Theme:
To edit your prompt in oh-my-zsh you need to edit a PROMPT
variable in your theme instead of PS1
. In your .zshrc file you will find a line that looks something like this:
ZSH_THEME="themename"
oh-my-zsh stores these themes in the ~/.oh-my-zsh/themes
folder. If you ls ~/.oh-my-zsh/themes
you will see a list of themes that you can change. The above theme would be named themename.zsh-theme
in this directory.
Customizing your Theme:
If you want a simple way to customize your oh-my-zsh theme you can copy a file already in this theme folder and edit that.
To change your prompt simply edit the PROMPT
variable. For example:
PROMPT=">>"
This would make two >
's your prompt.
I like editing the already existing simple theme. the simple.zsh-theme file looks like this:
PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY=" ✗"
ZSH_THEME_GIT_PROMPT_CLEAN=" ✔"
Applying the Changes:
Now just change the theme in your in your .zshrc file:
ZSH_THEME="simple"
And reload oh-my-zsh with:
. ~/.zshrc
For POWERLEVEL9K if you're using it
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
PS: Try POWERLEVEL10K, it's much better. trust me