The Mercurial 1.5 sprint is taking place in our offices this week-end and pair-programming with Steve made me want a better looking terminal. Have you seen his extravagant zsh prompt ? I used to have only 8 colors to decorate my shell prompt, but thanks to some time spent playing around, I now have 256.
Here is what I used to have in my bashrc for 8 colors:
NO_COLOUR="\[\033[0m\]" LIGHT_WHITE="\[\033[1;37m\]" WHITE="\[\033[0;37m\]" GRAY="\[\033[1;30m\]" BLACK="\[\033[0;30m\]" RED="\[\033[0;31m\]" LIGHT_RED="\[\033[1;31m\]" GREEN="\[\033[0;32m\]" LIGHT_GREEN="\[\033[1;32m\]" YELLOW="\[\033[0;33m\]" LIGHT_YELLOW="\[\033[1;33m\]" BLUE="\[\033[0;34m\]" LIGHT_BLUE="\[\033[1;34m\]" MAGENTA="\[\033[0;35m\]" LIGHT_MAGENTA="\[\033[1;35m\]" CYAN="\[\033[0;36m\]" LIGHT_CYAN="\[\033[1;36m\]" # set a fancy prompt export PS1="${RED}[\u@\h \W]\$${NO_COLOUR} "
Just put the following lines in your bashrc to get the 256 colors:
function EXT_COLOR () { echo -ne "\[\033[38;5;$1m\]"; } # set a fancy prompt export PS1="`EXT_COLOR 172`[\u@\h \W]\$${NO_COLOUR} "
Yay, I now have an orange prompt! I now need to write a script that will display useful information depending on the context. Displaying the status of the mercurial repository I am in might be my next step.
blog entry of