b035662e4c835f8b1ca81636a5a265d1a3394d17
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Merge pull request #1053 from cwoodcox/master
Added a neat theme called half-life. It's pretty and quite functional.
Diff
1diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme
2new file mode 100644
3index 0000000000000000000000000000000000000000..c8d09ce47fe2a178b906970fdea866dc777cbe9f
4--- /dev/null
5+++ b/themes/half-life.zsh-theme
6@@ -0,0 +1,99 @@
7+# prompt style and colors based on Steve Losh's Prose theme:
8+# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
9+#
10+# vcs_info modifications from Bart Trojanowski's zsh prompt:
11+# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
12+#
13+# git untracked files modification from Brian Carper:
14+# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
15+
16+function virtualenv_info {
17+ [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
18+}
19+PR_GIT_UPDATE=1
20+
21+setopt prompt_subst
22+autoload colors
23+colors
24+
25+autoload -U add-zsh-hook
26+autoload -Uz vcs_info
27+
28+#use extended color pallete if available
29+if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
30+ turquoise="%F{81}"
31+ orange="%F{166}"
32+ purple="%F{135}"
33+ hotpink="%F{161}"
34+ limegreen="%F{118}"
35+else
36+ turquoise="$fg[cyan]"
37+ orange="$fg[yellow]"
38+ purple="$fg[magenta]"
39+ hotpink="$fg[red]"
40+ limegreen="$fg[green]"
41+fi
42+
43+# enable VCS systems you use
44+zstyle ':vcs_info:*' enable git svn
45+
46+# check-for-changes can be really slow.
47+# you should disable it, if you work with large repositories
48+zstyle ':vcs_info:*:prompt:*' check-for-changes true
49+
50+# set formats
51+# %b - branchname
52+# %u - unstagedstr (see below)
53+# %c - stagedstr (see below)
54+# %a - action (e.g. rebase-i)
55+# %R - repository path
56+# %S - path in the repository
57+PR_RST="%{${reset_color}%}"
58+FMT_BRANCH=" on %{$turquoise%}%b%u%c${PR_RST}"
59+FMT_ACTION=" performing a %{$limegreen%}%a${PR_RST}"
60+FMT_UNSTAGED="%{$orange%}●"
61+FMT_STAGED="%{$limegreen%}●"
62+
63+zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
64+zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
65+zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
66+zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
67+zstyle ':vcs_info:*:prompt:*' nvcsformats ""
68+
69+
70+function steeef_preexec {
71+ case "$(history $HISTCMD)" in
72+ *git*)
73+ PR_GIT_UPDATE=1
74+ ;;
75+ *svn*)
76+ PR_GIT_UPDATE=1
77+ ;;
78+ esac
79+}
80+add-zsh-hook preexec steeef_preexec
81+
82+function steeef_chpwd {
83+ PR_GIT_UPDATE=1
84+}
85+add-zsh-hook chpwd steeef_chpwd
86+
87+function steeef_precmd {
88+ if [[ -n "$PR_GIT_UPDATE" ]] ; then
89+ # check for untracked files or updated submodules, since vcs_info doesn't
90+ if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
91+ PR_GIT_UPDATE=1
92+ FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST}"
93+ else
94+ FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c${PR_RST}"
95+ fi
96+ zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
97+
98+ vcs_info 'prompt'
99+ PR_GIT_UPDATE=
100+ fi
101+}
102+add-zsh-hook precmd steeef_precmd
103+
104+PROMPT=$'
105+%{$purple%}%n%{$reset_color%} in %{$limegreen%}%~%{$reset_color%}$(rvm-prompt " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$orange%} λ%{$reset_color%} '