Skip to content

Instantly share code, notes, and snippets.

@z4y4ts
Created April 28, 2012 14:27
Show Gist options
  • Save z4y4ts/2519452 to your computer and use it in GitHub Desktop.
Save z4y4ts/2519452 to your computer and use it in GitHub Desktop.
Color prompt with time
# Prompt setup (c) smax 2002, adapted for zsh (c) piranha 2004
# 0-black, 1-red, 2-green, 3-yellow, 4-blue, 5-magenta 6-cyan, 7-white
Cr() { echo '%{\033[3'$1'm%}'; }
hc=`Cr 6`; wc=`Cr 3`; tc=`Cr 7`; w=`Cr 7`; n=`Cr 9`; r=`Cr 1`; y=`Cr 6`; gr=`Cr 2`
[ $UID = 0 ] && at=$r%B'#'%b || at=$w'@'
PW_LEN=25
PS1="$wc%n$at$hc%m $wc%$PW_LEN<..<%~$w>$n"
export RPROMPT=$(echo "$gr%T$n")
unset n b Cr uc hc wc tc tty at r y gr
@chaliy
Copy link

chaliy commented Apr 28, 2012

Come to darkside. In Powershell this will be just:

function prompt { write-host $pwd [(date -f t)]">" }

@legigor
Copy link

legigor commented Apr 29, 2012

yeah, zsh sucking :)

@z4y4ts
Copy link
Author

z4y4ts commented Apr 29, 2012

Hey! Where is your love to cryptic? :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment