4 comments on “zsh ANSI prompt

  1. thanks a lot for the tips on editing PS1 in zsh!

    Previously, I have used something called TerminalColours.bundle which allows further coloring of the terminal by having folders appear one color, executables another, etc in your Terminal environment. Now I use Visor which includes this bundle.

    Unfortunately, when i began using zsh instead of bash, the colors went away. In order to make colors work originally in bash, i had to add the lines

    #colorize the Terminal
    export GREP_OPTIONS='--color=auto'
    export CLICOLOR=1;

    to my .bash_profile in my home folder. I've tried making a .profile and .zsh_profile as equivalents but this didn't do the trick!

    do you have any ideas? your help is much appreciated, and i believe the solution is closely tied with this topic of changing colors which you have talked about ; )

  2. For bright versions of the colors, try "fg_bold" instead of "fg": PS1="%{$fg_bold[red]%}%n%{$reset_color%}@%{$fg_bold[cyan]%}%m %{$fg_bold[yellow]%}%~ %{$reset_color%}%% "

    The secret sauce is in using "fg_bold" instead of "fg" for the color names.

    • Hey, thanks a lot! In my ~/.zshrc I did:


      autoload -U colors && colors
      PS1="%~ %{$fg_bold[blue]%}> %{$reset_color%}"

      One day I should bother with a more complex prompt.. I've been pretty minimal.

Leave a Reply

Your email address will not be published. Required fields are marked *