Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 87 lines (72 sloc) 2.515 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
7fb0b21 steeef merge steeef.zsh-theme from master
steeef authored
6 #
7 # git untracked files modification from Brian Carper:
8 # http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
c24936e steeef added steeef theme
steeef authored
9
10 function virtualenv_info {
11 [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
12 }
13 PR_GIT_UPDATE=1
14
15 setopt prompt_subst
16 autoload colors
17 colors
18
19 autoload -U add-zsh-hook
20 autoload -Uz vcs_info
21
22
7fb0b21 steeef merge steeef.zsh-theme from master
steeef authored
23 # enable VCS systems you use
24 zstyle ':vcs_info:*' enable git svn
25
c24936e steeef added steeef theme
steeef authored
26 # check-for-changes can be really slow.
27 # you should disable it, if you work with large repositories
28 zstyle ':vcs_info:*:prompt:*' check-for-changes true
29
30 # set formats
31 # %b - branchname
32 # %u - unstagedstr (see below)
33 # %c - stagedstr (see below)
34 # %a - action (e.g. rebase-i)
35 # %R - repository path
36 # %S - path in the repository
37 PR_RST="%{${reset_color}%}"
38 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})"
39 FMT_ACTION="(%{$fg[green]%}%a${PR_RST})"
7fb0b21 steeef merge steeef.zsh-theme from master
steeef authored
40 FMT_UNSTAGED="%{$fg[yellow]%}●"
41 FMT_STAGED="%{$fg[green]%}●"
c24936e steeef added steeef theme
steeef authored
42
43 zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
44 zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
45 zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
46 zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
47 zstyle ':vcs_info:*:prompt:*' nvcsformats ""
48
49
50 function steeef_preexec {
51 case "$(history $HISTCMD)" in
52 *git*)
53 PR_GIT_UPDATE=1
54 ;;
7fb0b21 steeef merge steeef.zsh-theme from master
steeef authored
55 *svn*)
56 PR_GIT_UPDATE=1
57 ;;
c24936e steeef added steeef theme
steeef authored
58 esac
59 }
60 add-zsh-hook preexec steeef_preexec
61
62 function steeef_chpwd {
63 PR_GIT_UPDATE=1
64 }
65 add-zsh-hook chpwd steeef_chpwd
66
67 function steeef_precmd {
7fb0b21 steeef merge steeef.zsh-theme from master
steeef authored
68 # check for untracked files or updated submodules, since vcs_info doesn't
69 if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) || -n $(git ls-files -m --exclude-standard 2> /dev/null) ]]; then
70 PR_GIT_UPDATE=1
71 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})"
72 else
73 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})"
74 fi
75 zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
76
c24936e steeef added steeef theme
steeef authored
77 if [[ -n "$PR_GIT_UPDATE" ]] ; then
78 vcs_info 'prompt'
79 PR_GIT_UPDATE=
80 fi
81 }
82 add-zsh-hook precmd steeef_precmd
83
84 PROMPT=$'
85 %{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%} $vcs_info_msg_0_
86 $(virtualenv_info)$ '
Something went wrong with that request. Please try again.