Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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