1 # On a mac with snow leopard, for nicer terminal colours:
 
   3 # - Install SIMBL: http://www.culater.net/software/SIMBL/SIMBL.php
 
   4 # - Download'Terminal-Colours': http://bwaht.net/code/TerminalColours.bundle.zip
 
   5 # - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist)
 
   6 # - Open Terminal preferences. Go to Settings -> Text -> More
 
   7 # - Change default colours to your liking.
 
   9 # Here are the colours from Textmate's Monokai theme:
 
  14 # Yellow: 252, 149, 30
 
  16 # Magenta: 250, 37, 115
 
  18 # White: 242, 242, 242
 
  20 # Thanks to Steve Losh: http://stevelosh.com/blog/2009/03/candy-colored-terminal/
 
  24 PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
 
  26 # The right-hand prompt
 
  28 RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}'
 
  30 # Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
 
  31 # %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} 
 
  33 # local time, color coded by last return code
 
  34 time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
 
  35 time_disabled="%{$fg[green]%}%*%{$reset_color%}"
 
  38 ZSH_THEME_GIT_PROMPT_PREFIX=" ☁  %{$fg[red]%}"
 
  39 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
 
  40 ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ☂" # Ⓓ
 
  41 ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" # ⓣ
 
  42 ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ☀" # Ⓞ
 
  44 ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✚" # ⓐ ⑃
 
  45 ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ⚡"  # ⓜ ⑁
 
  46 ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" # ⓧ ⑂
 
  47 ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄
 
  48 ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊
 
  50 # More symbols to choose from:
 
  51 # ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
 
  52 # ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵  ⩶ ⨠ 
 
  53 # ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟  ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ
 
  55 # Determine if we are using a gemset.
 
  56 function rvm_gemset() {
 
  57     GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
 
  58     if [[ -n $GEMSET ]]; then
 
  59         echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
 
  63 # Determine the time since last commit. If branch is clean,
 
  64 # use a neutral color, otherwise colors will vary according to time.
 
  65 function git_time_since_commit() {
 
  66     if git rev-parse --git-dir > /dev/null 2>&1; then
 
  67         # Only proceed if there is actually a commit.
 
  68         if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
 
  69             # Get the last commit.
 
  70             last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
 
  72             seconds_since_last_commit=$((now-last_commit))
 
  75             MINUTES=$((seconds_since_last_commit / 60))
 
  76             HOURS=$((seconds_since_last_commit/3600))
 
  78             # Sub-hours and sub-minutes
 
  79             DAYS=$((seconds_since_last_commit / 86400))
 
  80             SUB_HOURS=$((HOURS % 24))
 
  81             SUB_MINUTES=$((MINUTES % 60))
 
  83             if [[ -n $(git status -s 2> /dev/null) ]]; then
 
  84                 if [ "$MINUTES" -gt 30 ]; then
 
  85                     COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
 
  86                 elif [ "$MINUTES" -gt 10 ]; then
 
  87                     COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
 
  89                     COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
 
  92                 COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
 
  95             if [ "$HOURS" -gt 24 ]; then
 
  96                 echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
 
  97             elif [ "$MINUTES" -gt 60 ]; then
 
  98                 echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
 
 100                 echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|"
 
 103             COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
 
 104             echo "($(rvm_gemset)$COLOR~|"