cd84e37216b28d0b090390a572f22ac4a6512e5b
- Author
- Adam Lindberg <eproxus@gmail.com>
- Committer
- Adam Lindberg <eproxus@gmail.com>
- Date
Message
Merge remote-tracking branch 'robbyrussell/master'
Diff
1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
2index d72d90cf932e5dbf03aca6c2ce2400a8fba97422..c4522491bc083f1cade6207432a4f4e62c6d009c 100644
3--- a/oh-my-zsh.sh
4+++ b/oh-my-zsh.sh
5@@ -43,6 +43,9 @@ then
6 source "$RANDOM_THEME"
7 echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
8 else
9- source "$ZSH/themes/$ZSH_THEME.zsh-theme"
10+ if [ ! "$ZSH_THEME" = "" ]
11+ then
12+ source "$ZSH/themes/$ZSH_THEME.zsh-theme"
13+ fi
14 fi
15
16diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme
17new file mode 100644
18index 0000000000000000000000000000000000000000..7a287523e551673ac8bea986a9f9122639aae6aa
19--- /dev/null
20+++ b/themes/smt.zsh-theme
21@@ -0,0 +1,91 @@
22+# -----------------------------------------------------------------------------
23+# FILE: smt.zsh-theme
24+# DESCRIPTION: oh-my-zsh theme file, based on dogenpunk by Matthew Nelson.
25+# AUTHOR: Stephen Tudor (stephen@tudorstudio.com
26+# VERSION: 0.1
27+# SCREENSHOT: coming soon
28+# -----------------------------------------------------------------------------
29+
30+MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
31+local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%} "
32+
33+ZSH_THEME_GIT_PROMPT_PREFIX="|"
34+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
35+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$reset_color%}"
36+ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[red]%}!%{$reset_color%}"
37+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}"
38+
39+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
40+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
41+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
42+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
43+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
44+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
45+
46+# Format for git_prompt_long_sha() and git_prompt_short_sha()
47+ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}"
48+ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
49+
50+function prompt_char() {
51+ git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
52+ hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
53+ echo "%{$fg[cyan]%}◯%{$reset_color%}"
54+}
55+
56+# Colors vary depending on time lapsed.
57+ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
58+ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
59+ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
60+ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
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 "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
96+ elif [ "$MINUTES" -gt 60 ]; then
97+ echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
98+ else
99+ echo "[$COLOR${MINUTES}m%{$reset_color%}]"
100+ fi
101+ else
102+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
103+ echo "[$COLOR~]"
104+ fi
105+ fi
106+}
107+
108+PROMPT='
109+%{$fg[blue]%}%m%{$reset_color%} 福 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info)
110+%{$fg[red]%}%!%{$reset_color%} $(prompt_char) : '
111+
112+RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}'