Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 101 lines (86 sloc) 2.819 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
6d5e4ea @steeef use 256 colors, if available
steeef authored
22 #use extended color pallete if available
4ff0136 @steeef merge from master
steeef authored
23 if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
6d5e4ea @steeef use 256 colors, if available
steeef authored
24 turquoise="%F{81}"
25 orange="%F{166}"
26 purple="%F{135}"
27 hotpink="%F{161}"
28 limegreen="%F{118}"
29 else
30 turquoise="$fg[cyan]"
31 orange="$fg[yellow]"
32 purple="$fg[magenta]"
33 hotpink="$fg[red]"
34 limegreen="$fg[green]"
35 fi
c24936e @steeef added steeef theme
steeef authored
36
7fb0b21 @steeef merge steeef.zsh-theme from master
steeef authored
37 # enable VCS systems you use
38 zstyle ':vcs_info:*' enable git svn
39
c24936e @steeef added steeef theme
steeef authored
40 # check-for-changes can be really slow.
41 # you should disable it, if you work with large repositories
42 zstyle ':vcs_info:*:prompt:*' check-for-changes true
43
44 # set formats
45 # %b - branchname
46 # %u - unstagedstr (see below)
47 # %c - stagedstr (see below)
48 # %a - action (e.g. rebase-i)
49 # %R - repository path
50 # %S - path in the repository
51 PR_RST="%{${reset_color}%}"
6d5e4ea @steeef use 256 colors, if available
steeef authored
52 FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
53 FMT_ACTION="(%{$limegreen%}%a${PR_RST})"
54 FMT_UNSTAGED="%{$orange%}●"
55 FMT_STAGED="%{$limegreen%}●"
c24936e @steeef added steeef theme
steeef authored
56
57 zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
58 zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
59 zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
60 zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
61 zstyle ':vcs_info:*:prompt:*' nvcsformats ""
62
63
64 function steeef_preexec {
65 case "$(history $HISTCMD)" in
66 *git*)
67 PR_GIT_UPDATE=1
68 ;;
7fb0b21 @steeef merge steeef.zsh-theme from master
steeef authored
69 *svn*)
70 PR_GIT_UPDATE=1
71 ;;
c24936e @steeef added steeef theme
steeef authored
72 esac
73 }
74 add-zsh-hook preexec steeef_preexec
75
76 function steeef_chpwd {
77 PR_GIT_UPDATE=1
78 }
79 add-zsh-hook chpwd steeef_chpwd
80
81 function steeef_precmd {
82 if [[ -n "$PR_GIT_UPDATE" ]] ; then
c6b339f @steeef merge master
steeef authored
83 # check for untracked files or updated submodules, since vcs_info doesn't
4d6b532 @kristi add --directory flag
kristi authored
84 if git ls-files --other --exclude-standard --directory 2> /dev/null | grep -q "."; then
c6b339f @steeef merge master
steeef authored
85 PR_GIT_UPDATE=1
86 FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})"
87 else
88 FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
89 fi
90 zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
91
c24936e @steeef added steeef theme
steeef authored
92 vcs_info 'prompt'
93 PR_GIT_UPDATE=
94 fi
95 }
96 add-zsh-hook precmd steeef_precmd
97
98 PROMPT=$'
6d5e4ea @steeef use 256 colors, if available
steeef authored
99 %{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_
c24936e @steeef added steeef theme
steeef authored
100 $(virtualenv_info)$ '
Something went wrong with that request. Please try again.