1 5~PATH=~/bin${PATH:+:}$PATH
7 setopt EXTENDED_HISTORY
8 setopt HIST_EXPIRE_DUPS_FIRST
9 #setopt HIST_FIND_NO_DUPS
10 setopt HIST_REDUCE_BLANKS
11 setopt PUSHD_IGNORE_DUPS
13 autoload -U colors; colors
20 if [[ $TERM == (xterm|screen)* && $oldterm != $TERM$WINDOWID ]]; then
22 export oldterm=$TERM$WINDOWID
28 #PS1="%(?..%{${fg_bold[red]}%}%?%{$reset_color%} )%(2L.%{${fg_bold[yellow]}%}<%L>%{$reset_color%} .)%B%(#.%{${bg[red]}%}.)%m %(#..%{$fg[green]%})%#%{$reset_color%}%b "
29 #RPS1=" %{${fg_bold[green]}%}%~%{${fg_bold[black]}%}|%{${fg_bold[blue]}%}%(t.DING!.%*)%{$reset_color%}"
32 # Substitute vars. Notice that we're in "", so $vars here are
33 # replaced already here. All dynamic content needs to go
36 function prompt_generate {
40 # switch to red background when root
41 #PS1="$PS1%(#.%{${bg[red]}%}.)"
45 PS1="$PS1%{${fg_bold[black]}%}%~%b "
46 # git dynamic content, i.e. branch name
49 #PS1="$PS1%{${fg[magenta]}%}!%!$reset_color "
53 PS1="$PS1%(2L.%{${fg_bold[yellow]}%}<%L>%{$reset_color%} .)"
59 # If we're in paste mode, forget all the fancyness and only do
61 if [[ -n $paste_mode ]] {
65 PS1="$PS1%(?..%{${fg_bold[red]}%}%?%{$reset_color%} )"
67 PS1="$PS1%(#.%{${bg[white]%}%B.%{$fg[green]%})%# %{$reset_color%}"
71 function prompt_time {
77 curtime=(${(@s,:,)$(print -Pn "%D{%H:%M}")})
82 if [[ $minute -eq 0 && $lastding -ne $hour ]]; then
84 # not using ^G here, because then cat'ing
85 # this file will beep.
86 t="DING!$(printf '\a') "
88 PS1="$PS1%{${fg_bold[blue]}%}$t%{$reset_color%} "
94 ref=$(git symbolic-ref HEAD 2>/dev/null)
95 ref=${ref#refs/heads/}
98 PS1="$PS1%{${fg[cyan]}%}$ref%{$reset_color%} "
103 ref=$(git rev-parse HEAD 2>/dev/null)
106 # detached head, print commitid
107 PS1="$PS1%{${bg[cyan]}${fg[black]}%}$ref%{$reset_color%} "
112 function prompt_jobs {
113 # from http://www.miek.nl/blog/archives/2008/02/20/my_zsh_prompt_setup/index.html
118 for jobno (${(k)jobstates}) {
119 local fullstate=$jobstates[$jobno]
120 local state="${${(@s,:,)fullstate}[2]}"
121 js+=($jobno${state//[^+-]/})
123 if [[ $#js -gt 0 ]]; then
124 PS1="$PS1%{${fg[yellow]}%}[${(j:,:)js}]%{$reset_color%} "
133 function title_generate {}
135 if [[ $TERM == (xterm|screen)* ]]; then
136 function title_generate {
137 print -Pn "${title[start]}%n@%m:%~${title[end]}"
142 local -a cmd; cmd=(${(z)1})
159 print -n "${title[start]}"
161 if [[ -n "$checkjobs" ]]
163 # from: http://www.zsh.org/mla/workers/2000/msg03990.html
164 local -A jt; jt=(${(kv)jobtexts}) # Copy jobtexts for subshell
165 builtin jobs -l $checkjobs 2>/dev/null >>(read num rest
166 cmd=(${(z)${(e):-\$jt$num}})
174 print -n "${title[end]}"
178 if which todo >/dev/null 2>&1; then
180 # only print stuff in the interactive case
181 [[ ! -o interactive ]] && return
187 if [[ -r ~/.aliasrc ]]; then
193 if which vim >/dev/null 2>&1; then
194 export EDITOR=`which vim`
198 lesspipe=$(which lesspipe.sh 2>/dev/null) || \
199 lesspipe=$(which lesspipe 2>/dev/null)
200 if test -n "$lesspipe"; then
201 export LESSOPEN="|$lesspipe %s"
204 if which keychain >/dev/null 2>&1; then
205 [ -f ~/.ssh/id_rsa ] && keychain -q id_rsa --nogui
206 [ -f ~/.ssh/id_dsa ] && keychain -q id_dsa --nogui
207 source ~/.keychain/$HOST-sh
211 bindkey '\e[H' beginning-of-line
212 bindkey '\e[F' end-of-line
213 bindkey '\eOH' beginning-of-line
214 bindkey '\eOF' end-of-line
215 bindkey '\e[1~' beginning-of-line
216 bindkey '\e[4~' end-of-line
217 autoload -U down-line-or-beginning-search
218 autoload -U up-line-or-beginning-search
219 zle -N down-line-or-beginning-search
220 zle -N up-line-or-beginning-search
221 bindkey '\e[B' down-line-or-beginning-search
222 bindkey '\e[A' up-line-or-beginning-search
224 bindkey '\eOP' run-help
225 bindkey '\e[M' run-help
226 bindkey '\e[1;5D' backward-word
227 bindkey '\e[1;5C' forward-word
228 bindkey '\e[3~' delete-char
229 #WORDCHARS=${WORDCHARS//[\/&.;=]}
230 autoload -U select-word-style
231 select-word-style bash
232 zstyle ':zle:transpose-words' word-style shell
233 setopt NO_FLOW_CONTROL
235 autoload -U compinit; compinit
237 if [[ -r ~/.zshrc.local ]]; then
238 source ~/.zshrc.local