Posted by: spiralofhope | 2009-04-23

zsh ANSI prompt

moved to http://blog.spiralofhope.com/445-zsh-ansi-prompt.html

About these ads

Responses

  1. 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.

  2. 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 ; )

    • I think these were the applications you mentioned:

      TerminalColors:

      http://www.culater.net/software/TerminalColors/TerminalColors.php

      Visor:

      http://visor.binaryage.com/

      I assume you’re on a mac. If so, then things may be wildly different for you.

      I only see something vaguely similar with my environment variables..


      LS_OPTIONS='-F --color=auto'

      But your issue is at the shell level. This should probably work:


      echo -e "\x1b\x5b0;32;40mgreen text"

      If so, then it’s an issue at the ls level. Maybe this works?:


      ls --color=always

      If that works then I’d suggest just solving this with an alias.

      If not, then I have no clue, sorry.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: