TLDR
vim +92 ~/.oh-my-zsh/custom/themes/agnoster.zsh-theme
and change prompt from
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
to
prompt_segment black default "%(!.%{%F{yellow}%}.)text-you-want-to-appear"
then source it with:
. ~/.zshrc
DETAILS
I put my custom theme in:
~/.oh-my-zsh/custom/themes/
e.g.
~/.oh-my-zsh/custom/themes/agnoster.zsh-theme
Editing the PS1 means changing the PROMPT
variable which looks like this:
PROMPT='%{%f%b%k%}$(build_prompt) '
From man zshmisc
%{…%}
Include a string as a literal escape sequence. The string within the braces
should not change the cursor position. Brace pairs can nest.A positive numeric argument between the % and the { is treated as described for
%G below.
And
%f%b%k
%F (%f)
Start (stop) using a different foreground colour, if supported by the terminal.
The colour may be specified two ways: either as a numeric argument, as normal,
or by a sequence in braces following the %F, for example %F{red}. In the lat-
ter case the values allowed are as described for the fg zle_highlight
attribute; see Character Highlighting in zshzle(1). This means that numeric
colours are allowed in the second format also.%B (%b)
Start (stop) boldface mode%K (%k)
Start (stop) using a different bacKground colour. The syntax is identical to
that for %F and %f.
and
1 2 3 4 5 6 7 8 9 10 11 |
build_prompt() { RETVAL=$? prompt_status prompt_virtualenv prompt_context prompt_dir prompt_git prompt_bzr prompt_hg prompt_end } |
I wanted to remove my username which would point to this:
1 2 3 4 5 6 |
# Context: user@hostname (who am I and where am I) prompt_context() { if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m" fi } |
and
%n@%m
is
%n $USERNAME.
%m The hostname up to the first
.'. An integer may follow the
%’ to specify how
many components of the hostname are desired. With a negative integer, trailing
components of the hostname are shown.
https://stackoverflow.com/questions/35281630/how-do-i-change-my-ps1-on-a-macbook-for-oh-my-zsh