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