1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,68 @@ |
0 |
+# prompt style and colors based on Steve Losh's Prose theme: |
|
1 |
+# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme |
|
2 |
+# |
|
3 |
+# vcs_info modifications from Bart Trojanowski's zsh prompt: |
|
4 |
+# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt |
|
5 |
+ |
|
6 |
+function virtualenv_info { |
|
7 |
+ [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' |
|
8 |
+} |
|
9 |
+PR_GIT_UPDATE=1 |
|
10 |
+ |
|
11 |
+setopt prompt_subst |
|
12 |
+autoload colors |
|
13 |
+colors |
|
14 |
+ |
|
15 |
+autoload -U add-zsh-hook |
|
16 |
+autoload -Uz vcs_info |
|
17 |
+ |
|
18 |
+ |
|
19 |
+# check-for-changes can be really slow. |
|
20 |
+# you should disable it, if you work with large repositories |
|
21 |
+zstyle ':vcs_info:*:prompt:*' check-for-changes true |
|
22 |
+ |
|
23 |
+# set formats |
|
24 |
+# %b - branchname |
|
25 |
+# %u - unstagedstr (see below) |
|
26 |
+# %c - stagedstr (see below) |
|
27 |
+# %a - action (e.g. rebase-i) |
|
28 |
+# %R - repository path |
|
29 |
+# %S - path in the repository |
|
30 |
+PR_RST="%{${reset_color}%}" |
|
31 |
+FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" |
|
32 |
+FMT_ACTION="(%{$fg[green]%}%a${PR_RST})" |
|
33 |
+FMT_UNSTAGED="%{$fg[yellow]%}!" |
|
34 |
+FMT_STAGED="%{$fg[yellow]%}?" |
|
35 |
+ |
|
36 |
+zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" |
|
37 |
+zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" |
|
38 |
+zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" |
|
39 |
+zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" |
|
40 |
+zstyle ':vcs_info:*:prompt:*' nvcsformats "" |
|
41 |
+ |
|
42 |
+ |
|
43 |
+function steeef_preexec { |
|
44 |
+ case "$(history $HISTCMD)" in |
|
45 |
+ *git*) |
|
46 |
+ PR_GIT_UPDATE=1 |
|
47 |
+ ;; |
|
48 |
+ esac |
|
49 |
+} |
|
50 |
+add-zsh-hook preexec steeef_preexec |
|
51 |
+ |
|
52 |
+function steeef_chpwd { |
|
53 |
+ PR_GIT_UPDATE=1 |
|
54 |
+} |
|
55 |
+add-zsh-hook chpwd steeef_chpwd |
|
56 |
+ |
|
57 |
+function steeef_precmd { |
|
58 |
+ if [[ -n "$PR_GIT_UPDATE" ]] ; then |
|
59 |
+ vcs_info 'prompt' |
|
60 |
+ PR_GIT_UPDATE= |
|
61 |
+ fi |
|
62 |
+} |
|
63 |
+add-zsh-hook precmd steeef_precmd |
|
64 |
+ |
|
65 |
+PROMPT=$' |
|
66 |
+%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%} $vcs_info_msg_0_ |
|
67 |
+$(virtualenv_info)$ ' |