3 # Harr. "Borrowing" from the grml zshell config, this now supports
4 # a much nicer prompt setup, should zsh be recent enough to support it.
5 # That is, anything >= 4.3.7, the older ones keep using my old way.
7 if zrcautoload promptinit
&& promptinit
2>/dev
/null
; then
8 zstyle
':prompt:ganneff' vcs_info true
9 zstyle
':prompt:ganneff' set_vcs_info_defaults true
10 zstyle
':vcs_info:*' disable cdv darcs mtn tla hg fossil p4
11 zstyle
':prompt:ganneff' colors
${COLORS}
12 zstyle
':prompt:ganneff' nicelines
${LINEDRAW}
13 zstyle
':prompt:ganneff' battery none
14 zstyle
':prompt:ganneff:right:setup' use-rprompt true
15 zstyle
':prompt:ganneff:left:full:setup' items \
16 ulcorner line openparentheses user
at host pts closeparentheses line
history \
17 line shell-level line flexline openparentheses path closeparentheses line urcorner newline \
18 llcorner line rc openparentheses
time closeparentheses line vcs line change-root pipe space
19 zstyle
':prompt:ganneff:right:full:setup' items \
20 pipe line openparentheses
date closeparentheses line lrcorner
21 zstyle
':prompt:ganneff:left:small:setup' items \
22 ulcorner line openparentheses user
at host closeparentheses line openparentheses path closeparentheses newline \
23 llcorner line rc openparentheses
time closeparentheses line vcs line pipe space
25 zstyle
':prompt:ganneff:*:items:date' token
'%D{%Y-%m-%d [d:%j/w:%V]}'
27 # zstyle ':prompt:ganneff:extra:ganneff' pre '${PR_RED}'
28 # zstyle ':prompt:ganneff:extra:ganneff' post '${PR_NO_COLOR}'
29 # zstyle ':prompt:ganneff:extra:ganneff' token '$BLABLA'
30 # zstyle ':prompt:ganneff:extra:ganneff' precmd jj_blabla
36 # how often should the periodic function be called? I take every 30seconds here.
37 # Important: The periodic function is only called when
38 # - the defined time $PERIOD elapsed
40 # - the prompt gets displayed again!
41 # Its not cron-like "execute this really every 30s in the background"!
43 # But for sanity reasons - make this conditional on existance of tools, but never
44 # overwrite existing values
45 if which yacpi
> /dev
/null
; then
46 (( ${+PERIOD} )) ||
export PERIOD
=30
48 elif which ibam
> /dev
/null
; then
49 (( ${+PERIOD} )) ||
export PERIOD
=30
52 (( ${+PERIOD} )) ||
unset PERIOD
56 # the following is for prompt and gets modified in periodic()
57 typeset
-A ACPIDISPLAY
58 # I know, this stuff is currently made only for my laptop. But right now i cant be bothered
59 # to make it more generic
60 PR_SLASH
='${PR_YELLOW}/${PR_RED}'
63 # I call periodic here one time to have all the variables it sets initialized. Or
64 # the first prompt would look ugly.
67 # gather version control information for inclusion in a prompt
68 # we will only be using one variable, so let the code know now.
69 if is439
&& zrcautoload vcs_info
&& vcs_info
; then
70 zstyle
':vcs_info:*' max-exports
1
71 zstyle
':vcs_info:*' disable cdv darcs mtn tla hg fossil p4
72 zstyle
':vcs_info:*' use-prompt-escapes
73 zstyle
':vcs_info:*' use_simple
74 zstyle
':vcs_info:*' stagedstr
"!"
75 zstyle
':vcs_info:*' unstagedstr
"?"
76 zstyle
':vcs_info:*' check-for-changes true
78 # change vcs_info formats for the prompt
79 if [[ "$TERM" == dumb
]]; then
80 zstyle
':vcs_info:*' actionformats
"(%s%)-[%b|%a] "
81 zstyle
':vcs_info:*' formats
"(%s%)-[%b] "
83 # these are the same, just with a lot of colours:
84 # zstyle ':vcs_info:*' actionformats "$%s${PR_YELLOW})${PR_CYAN}-${PR_YELLOW}[${PR_GREEN}%b${PR_YELLOW}|${PR_RED}%a${PR_YELLOW}]${PR_NO_COLOUR}"
85 zstyle
':vcs_info:(sv[nk]|bzr):*' branchformat
"%b%{$fg[red]%}:%{$fg[yellow]%}%r"
86 zstyle
':vcs_info:git*' formats
"%{$fg[yellow]%}%s %{$reset_color%} %{$fg[green]%}%b%{$reset_color%}%m%u%c%{$reset_color%} "
87 zstyle
':vcs_info:git*' actionformats
"%{$fg[yellow]%}%s%{$reset_color%} %{$fg[green]%}%b%{$reset_color%} $fg[red]%}(%a)%{$reset_color%} %m%u%c%{$reset_color%} "
95 # See if our (effective) group has changed at all. (For instance, we're
96 # in a subshell that is setgid.) This happens when i type "newgrp group"
98 # I haven't put this in the precmd function because I don't expect
99 # my effective group to change over the life of the shell. It can if
100 # I'm running with root privileges, but I deliberately don't use zsh for
101 # root in any case, because that encourages me to not use root for
102 # anything I don't have to use it for.
103 if [[ "$ORIGGID" != "$EGID" ]]; then
104 # Set for either normal prompt and xterm title bars.
105 GNAME
=$
(grpname
$EGID)
106 if [[ "$TERM" = "xterm" ]]; then
109 psvar
[5]="g[$GNAME] "