Unable to customize PS1 prompt

Hey, I don’t know what’s up with this :confused:

If I do echo $PS1 I get this hideous config for it

echo $PS1
%K{blue}%n@%m%k %B%F{cyan}%(4~|...|)%3~%F{white} %# %b%f%k

I can’t figure out where this is coming from, and it isn’t part of archlabs .zshrc and not part of my config. And if I add my own PS1 into /home/user/.zshrc it’s not taking effect for some reason. I closed and reopened terminal, even did logout and finally reboot but no effect

Any ideas?

What did you add?

The last two lines of the default .zshrc are:

# initialize prompt with a decent built-in theme
prompt adam1

I believe that is setting a built-in prompt.


That did the trick! Also I had no idea there are some other themes inside /usr/share/zsh/functions/Prompts/ and now I went through them all and tried everything.

I was a bit annoyed by the user@host field having blue background with white text and by the “%” symbol. And if I cd’ed into Downloads/Torrents for some reason the prompt began from a new line with just the % symbol. But not when I just cd into Downloads. Other than that I actually like the format XD!

I had something basic PS1="%n@%m%~ $ " with no colors setup yet, as I was trying to get rid from the old colors first lol. And I was just utterly confused why adding this PS1 wasn’t working, but it always did in the past xd and that was the only way I knew how

Thanks :slight_smile:

1 Like

Glad that you got it fixed @Sorcerer ,also props to @PackRat also !


This is from my ~/.zshrc - (I forget where I found the tutorial for this)

setprompt() {
  setopt prompt_subst

  if [[ -n "$SSH_CLIENT"  ||  -n "$SSH2_CLIENT" ]]; then 

    " "


zsh probably has something similar for their built-in prompts, so when you did the echo $PS1 your output had all that other code in it (which is what I get):

[pts/0]-[~]% echo $PS1
[pts/0]-[~]% cd /mnt/public/images
1 Like

I have a pretty nice theme (imo) here. It uses the built-in zsh prompt style and can be easily customized by setting a few things before loading the theme.

It’s expected to be on the fpath for zsh (another built-in specific), I do mine as follows

mkdir ~/.zsh/fpath
curl -fSL https://bitbucket.org/natemaia/dotfiles/raw/master/configs/home/nate/.zsh/fpath/prompt_simpl_setup -o ~/.zsh/fpath/prompt_simpl_setup

echo 'typeset -Ug fpath=($HOME/.zsh/fpath $fpath)' > ~/.zshrc

You can easily customize things through ~/.zshrc (before loading the prompt)

# disable multi-line prompt and change the arrow
_PMT_LNBR1="➜ " # _PMT_ARROW for single line prompts (empty _PMT_NEWLINE)

# for all the defaults and what can be changed see:
#    ~/.zsh/fpath/prompt_simpl_setup
#    or run
#    which prompt_defaults | less

Now load the prompt

echo 'promptinit; prompt simpl' > ~/.zshrc

It detects when running in a subshell and provides the parent process as well as adding more prompt characters to show the shell level. Here’s a little scrot for example (without any changes to defaults, unlike above)

Here’s one with the above two changes, this also shows the right prompt which shows the time

There is also fairly good git integration (no other vcs though) which can be customized or disabled if you like, for very large repos like the linux kernel it will be slow and make the shell unresponsive, to avoid this you can run (or add it to zshrc)


oh-my-zsh is another option. It’s not perfect, but can get you going easily.