1badb744bf12935273db4adb2eb327908be5bc5e
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
1diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme
2new file mode 100644
3index 0000000000000000000000000000000000000000..ca2a8862fcc213d4fe708aa7d4417f726f6b174d
4--- /dev/null
5+++ b/themes/peepcode.zsh-theme
6@@ -0,0 +1,44 @@
7+#
8+# Based on Geoffrey Grosenbach's peepcode zsh theme from
9+# https://github.com/topfunky/zsh-simple
10+#
11+
12+git_repo_path() {
13+ git rev-parse --git-dir 2>/dev/null
14+}
15+
16+git_commit_id() {
17+ git rev-parse --short HEAD 2>/dev/null
18+}
19+
20+git_mode() {
21+ if [[ -e "$repo_path/BISECT_LOG" ]]; then
22+ echo "+bisect"
23+ elif [[ -e "$repo_path/MERGE_HEAD" ]]; then
24+ echo "+merge"
25+ elif [[ -e "$repo_path/rebase" || -e "$repo_path/rebase-apply" || -e "$repo_path/rebase-merge" || -e "$repo_path/../.dotest" ]]; then
26+ echo "+rebase"
27+ fi
28+}
29+
30+git_dirty() {
31+ if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then
32+ echo " %{$fg_bold[grey]%}✗%{$reset_color%}"
33+ fi
34+}
35+
36+git_prompt() {
37+ local cb=$(current_branch)
38+ if [ -n "$cb" ]; then
39+ local repo_path=$(git_repo_path)
40+ echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
41+ fi
42+}
43+
44+local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
45+
46+PROMPT='
47+%~
48+${smiley} %{$reset_color%}'
49+
50+RPROMPT='%{$fg[white]%} $(~/.rvm/bin/rvm-prompt)$(git_prompt)%{$reset_color%}'