]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/themes/wedisagree.zsh-theme
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / themes / wedisagree.zsh-theme
1 # On a mac with snow leopard, for nicer terminal colours:
2
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.
8
9 # Here are the colours from Textmate's Monokai theme:
10
11 # Black: 0, 0, 0
12 # Red: 229, 34, 34
13 # Green: 166, 227, 45
14 # Yellow: 252, 149, 30
15 # Blue: 196, 141, 255
16 # Magenta: 250, 37, 115
17 # Cyan: 103, 217, 240
18 # White: 242, 242, 242
19
20 # Thanks to Steve Losh: http://stevelosh.com/blog/2009/03/candy-colored-terminal/
21
22 # The prompt
23
24 PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
25
26 # The right-hand prompt
27
28 RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}'
29
30 # Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
31 # $(ruby_prompt_info) 
32
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%}"
36 time=$time_enabled
37
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]%} ☀" # Ⓞ
43
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]%} ♒" # ⓤ ⑊
49 ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙"
50
51 ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[yellow]%}"
52 ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
53
54 # More symbols to choose from:
55 # ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
56 # ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵  ⩶ ⨠ 
57 # ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟  ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ
58
59 # Determine if we are using a gemset.
60 function rvm_gemset() {
61     GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
62     if [[ -n $GEMSET ]]; then
63         echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
64     fi 
65 }
66
67 # Determine the time since last commit. If branch is clean,
68 # use a neutral color, otherwise colors will vary according to time.
69 function git_time_since_commit() {
70     if git rev-parse --git-dir > /dev/null 2>&1; then
71         # Only proceed if there is actually a commit.
72         if last_commit=`git -c log.showSignature=false log --pretty=format:'%at' -1 2> /dev/null`; then
73             now=`date +%s`
74             seconds_since_last_commit=$((now-last_commit))
75
76             # Totals
77             MINUTES=$((seconds_since_last_commit / 60))
78             HOURS=$((seconds_since_last_commit/3600))
79            
80             # Sub-hours and sub-minutes
81             DAYS=$((seconds_since_last_commit / 86400))
82             SUB_HOURS=$((HOURS % 24))
83             SUB_MINUTES=$((MINUTES % 60))
84             
85             if [[ -n $(git status -s 2> /dev/null) ]]; then
86                 if [ "$MINUTES" -gt 30 ]; then
87                     COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
88                 elif [ "$MINUTES" -gt 10 ]; then
89                     COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
90                 else
91                     COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
92                 fi
93             else
94                 COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
95             fi
96
97             if [ "$HOURS" -gt 24 ]; then
98                 echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
99             elif [ "$MINUTES" -gt 60 ]; then
100                 echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
101             else
102                 echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|"
103             fi
104         else
105             COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
106             echo "($(rvm_gemset)$COLOR~|"
107         fi
108     fi
109 }