1 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%(#.%{${fg[green]%}}%B.%%%{$reset_color%} "
68 #PS1="$PS1%(..%{$fg[green]%}%%) %{$reset_color%}"
69 #PS1="$PS1%(#.%{${fg[red]%}%B.%{$fg[green]%})%# %{$reset_color%}"
70 PS1="$PS1%(!.%{$fg_bold[red]%}.%{$fg[green]%})%# %{$reset_color%}"
74 function prompt_time {
80 curtime=(${(@s,:,)$(print -Pn "%D{%H:%M}")})
85 if [[ $minute -eq 0 && $lastding -ne $hour ]]; then
87 # not using ^G here, because then cat'ing
88 # this file will beep.
89 t="DING!$(printf '\a') "
91 PS1="$PS1%{${fg_bold[blue]}%}$t%{$reset_color%} "
97 ref=$(git symbolic-ref HEAD 2>/dev/null)
98 ref=${ref#refs/heads/}
101 PS1="$PS1%{${fg[cyan]}%}$ref%{$reset_color%} "
106 ref=$(git rev-parse HEAD 2>/dev/null)
109 # detached head, print commitid
110 PS1="$PS1%{${bg[cyan]}${fg[black]}%}$ref%{$reset_color%} "
115 function prompt_jobs {
116 # from http://www.miek.nl/blog/archives/2008/02/20/my_zsh_prompt_setup/index.html
121 for jobno (${(k)jobstates}) {
122 local fullstate=$jobstates[$jobno]
123 local state="${${(@s,:,)fullstate}[2]}"
124 js+=($jobno${state//[^+-]/})
126 if [[ $#js -gt 0 ]]; then
127 PS1="$PS1%{${fg[yellow]}%}[${(j:,:)js}]%{$reset_color%} "
136 function title_generate {}
138 if [[ $TERM == (xterm|screen)* ]]; then
139 function title_generate {
140 print -Pn "${title[start]}%n@%m:%~${title[end]}"
145 local -a cmd; cmd=(${(z)1})
162 print -n "${title[start]}"
164 if [[ -n "$checkjobs" ]]
166 # from: http://www.zsh.org/mla/workers/2000/msg03990.html
167 local -A jt; jt=(${(kv)jobtexts}) # Copy jobtexts for subshell
168 builtin jobs -l $checkjobs 2>/dev/null >>(read num rest
169 cmd=(${(z)${(e):-\$jt$num}})
177 print -n "${title[end]}"
181 if which todo >/dev/null 2>&1; then
183 # only print stuff in the interactive case
184 [[ ! -o interactive ]] && return
190 if [[ -r ~/.aliasrc ]]; then
196 if which vim >/dev/null 2>&1; then
197 export EDITOR=`which vim`
201 lesspipe=$(which lesspipe.sh 2>/dev/null) || \
202 lesspipe=$(which lesspipe 2>/dev/null)
203 if test -n "$lesspipe"; then
204 export LESSOPEN="|$lesspipe %s"
207 if which keychain >/dev/null 2>&1; then
208 [ -f ~/.ssh/id_rsa ] && keychain -q id_rsa --nogui
209 [ -f ~/.ssh/id_dsa ] && keychain -q id_dsa --nogui
210 source ~/.keychain/$HOST-sh
214 bindkey '\e[H' beginning-of-line
215 bindkey '\e[F' end-of-line
216 bindkey '\eOH' beginning-of-line
217 bindkey '\eOF' end-of-line
218 bindkey '\e[1~' beginning-of-line
219 bindkey '\e[4~' end-of-line
220 autoload -U down-line-or-beginning-search
221 autoload -U up-line-or-beginning-search
222 zle -N down-line-or-beginning-search
223 zle -N up-line-or-beginning-search
224 bindkey '\e[B' down-line-or-beginning-search
225 bindkey '\e[A' up-line-or-beginning-search
227 bindkey '\eOP' run-help
228 bindkey '\e[M' run-help
229 bindkey '\e[1;5D' backward-word
230 bindkey '\e[1;5C' forward-word
231 bindkey '\e[3~' delete-char
232 #WORDCHARS=${WORDCHARS//[\/&.;=]}
233 autoload -U select-word-style
234 select-word-style bash
235 zstyle ':zle:transpose-words' word-style shell
236 setopt NO_FLOW_CONTROL
238 autoload -U compinit; compinit
240 if [[ -r ~/.zshrc.local ]]; then
241 source ~/.zshrc.local