]> git.siccegge.de Git - dotfiles/zsh.git/blob - zshrc
fd2baf2825bdb7838379deb6cb5315c4affd1f8b
[dotfiles/zsh.git] / zshrc
1 #!/bin/zsh
2
3 setopt auto_cd extended_glob auto_pushd pushd_ignore_dups
4 setopt hist_ignore_all_dups append_history extended_history hist_reduce_blanks
5 setopt correct complete_in_word
6 setopt prompt_subst transient_rprompt
7
8 HISTFILE=~/.histfile
9 HISTSIZE=10000
10 SAVEHIST=12000
11 DOMAIN=`hostname -f`
12
13 eval `dircolors`
14 eval `lesspipe`
15
16 export EDITOR="emacsclient -a '' -nw"
17 export PAGER=less
18
19 export LESS_TERMCAP_mb=$'\e[01;31m'
20 export LESS_TERMCAP_md=$'\e[01;31m'
21 export LESS_TERMCAP_me=$'\e[0m'
22 export LESS_TERMCAP_se=$'\e[0m'
23 export LESS_TERMCAP_so=$'\e[01;44;33m'
24 export LESS_TERMCAP_ue=$'\e[0m'
25 export LESS_TERMCAP_us=$'\e[01;32m'
26
27 autoload -Uz compinit
28 autoload -Uz vcs_info
29 autoload -Uz colors
30
31 compinit
32 vcs_info
33 colors
34
35 zmodload -i zsh/complist
36
37 _force_rehash() {
38 if (( CURRENT == 1 )); then
39 rehash
40 fi
41 # We didn't really complete anything.
42 return 1
43 }
44
45 zstyle :compinstall filename '/home/christoph/.zshrc'
46 zstyle ':completion:*' menu select=3
47 zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2|_uni|_debian)(N) /dev/null)"}%%[# ]*}//,/ })'
48 zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
49 zstyle ':completion:::::' completer _force_rehash _complete _approximate _expand _ignored
50 zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'
51 zstyle ':completion:*:(^approximate):*' matcher-list 'm:{a-z}={A-Z}'
52
53 bindkey -e
54 bindkey '\ee' backward-word
55 bindkey '\ef' forward-word
56 bindkey '\e[B' down-line-or-search
57 bindkey '\e[A' up-line-or-search
58 bindkey '\e[28~' run-help
59
60
61
62 setWindowTitle(){
63 echo -e '\033]0;'$1'\007'
64 }
65
66 precmd () {
67 vcs_info
68 setWindowTitle ${USER}@${HOST}
69
70 if [[ $UID == 0 && $+commands[systemctl] != 0 ]]
71 then
72 use_systemd=true
73 systemd_failed="`systemctl --state=failed | grep failed | cut -d \ -f 2 | tr '\n' ' '`"
74 fi
75 }
76
77 config=("default" "`uname -s`")
78
79 case "${DOMAIN//cs.fau.de/informatik.uni-erlangen.de}" in
80 (*.debian.org)
81 export EMAIL=christoph@debian.org
82 config=($config debian)
83 ;;
84 (faui49*.uni-erlangen.de)
85 export EMAIL=Christoph.Egger@cs.fau.de
86 config=($config i4lab)
87 ;;
88 (faui0*.informatik.uni-erlangen.de|faui48*.informatik.uni-erlangen.de)
89 export EMAIL=siccegge@cs.fau.de
90 config=($config cip)
91 ;;
92 (*.siccegge.de)
93 export MAIL=christoph@christoph-egger.org
94 config=($config home)
95 ;;
96 esac
97
98 if [[ $UID == 0 && $+commands[systemctl] != 0 ]]
99 then
100 PROMPT=$'%{$fg[red]>> $systemd_failed$reset_color%}\n'
101 else
102 PROMPT=""
103 fi
104
105 PROMPT+=$'%{$fg[yellow]%}%n@%{$fg[magenta]%}%m%{$reset_color%} %~ \n%{$fg[cyan]%}%T%{$reset_color%} %0(?,%{$fg[green]%},%{$fg[red]%}%s)%?%{$reset_color%} %# '
106
107 RPROMPT='${vcs_info_msg_0_}'
108
109 export DEBEMAIL='christoph@debian.org'
110 export DEBFULLNAME='Christoph Egger'
111 export DEB_BUILD_OPTIONS="parallel=$(getconf _NPROCESSORS_ONLN)"
112
113
114 for ftype in aliases includes
115 do
116 for location in $config
117 do
118 if [ -f ~/.zsh/${ftype}/${location}.zsh ]
119 then
120 source ~/.zsh/${ftype}/${location}.zsh
121 fi
122 done
123 done
124
125
126
127 karma () {
128 gpg --fingerprint $1 >> ${HOME}/karma
129 printf '\n-----\n\n' >> ${HOME}/karma
130 }
131
132 gpgrefresh () {
133 gpg --refresh-keys 2>&1 | grep -v 'nicht geƤndert'
134 }
135
136 sponsor() {
137 pkgname=`echo $i | rcut -d '/' -f 1 | cut -d '_' -f 1`
138 apt-get --download-only -t unstable $pkgname
139 dget $i
140 }
141
142 path=(${HOME}/bin $path)
143 fpath=(${HOME}/.zsh/functions/$CONFIG ${HOME}/.zsh/functions/default $fpath)
144
145 export PATH
146 export FPATH
147
148 alias wb="ssh -t buildd.debian.org wb"