1 # .zshrc
2 # Last Modified: Fri 01 Oct 2004 08:19:12 AM MDT
3
4 # load autocompletion modules
5 autoload -U compinit && compinit
6 zmodload -i zsh/complist
7 autoload -U zsh-mime-setup
8 zsh-mime-setup
9
10 # ignore files in completion
11 fignore=( .BAK .bak .alt .old .aux .toc .swp \~)
12
13 # WTF fix this
14 export PATH=$PATH:/home/sdk/.bin:/usr/local/bin/:/sbin:/usr/sbin:/usr/local/games
15
16 # for rubygems
17 #export PATH=$PATH:/usr/games:$HOME/.gem/ruby/1.8/bin:/var/lib/gems/1.9.0/bin
18
19 # termcap color information for colorized manpages
20 export LESS_TERMCAP_mb=$'\E[01;31m'
21 export LESS_TERMCAP_md=$'\E[01;31m'
22 export LESS_TERMCAP_me=$'\E[0m'
23 export LESS_TERMCAP_se=$'\E[0m'
24 export LESS_TERMCAP_so=$'\E[01;44;33m'
25 export LESS_TERMCAP_ue=$'\E[0m'
26 export LESS_TERMCAP_us=$'\E[01;32m'
27
28 # colorize ls with *nice* colors
29 #eval `dircolors ~/.dir_colors`
30 export LS_COLORS='no=00:fi=00:di=1:ln=33:pi=36:so=96:do=01;35:bd=34:cd=34:or=40;31;01:ex=35:*.tar=90:*.tgz=90:*.arj=90:*.taz=90:*.lzh=90:*.zip=90:*.z=90:*.Z=90:*.gz=90:*.bz2=90:*.deb=90:*.rpm=90:*.css=01;33:*.html=01;33:*.htm=01;33:*.php=01;33:*.c=01;33:*.cc=01;33:*.cpp=01;33:*.pl=01;33:*.h=01;33:*.java=01;33:*.txt=01;37:*.jpg=36:*.gif=36:*.bmp=36:*.ppm=36:*.tga=36:*.xbm=36:*.xpm=36:*.tif=36:*.png=36:*.fli=36:*.gl=36:*.dl=36:*.mpg=01;35:*.mpeg=01;35:*.wmv=01;35:*.mov=01;35:*.avi=01;35:*.mpg=01;35:*.mkv=01;35:*.rar=90';
31
32 # -----/ Some colors /-----
33 export red=$'%{\e[0;31m%}'
34 export RED=$'%{\e[1;31m%}'
35 export green=$'%{\e[0;32m%}'
36 export GREEN=$'%{\e[1;32m%}'
37 export blue=$'%{\e[0;34m%}'
38 export BLUE=$'%{\e[1;34m%}'
39 export purple=$'%{\e[0;35m%}'
40 export PURPLE=$'%{\e[1;35m}'
41 export cyan=$'%{\e[0;36m%}'
42 export CYAN=$'%{\e[1;36m}'
43 export WHITE=$'%{\e[1;37m}'
44 export white=$'%{\e[0;37m}'
45 export NC=$'%{\e[0m%}'
46 export yellow=$'%{\e[0;33m%}'
47
48 # reset all LC*
49 unset LC_NAME
50 unset LC_TIME
51 unset LC_CTYPE
52 unset LC_MEASUREMENT
53 unset LANG
54 unset LC_COLLATE
55 unset LC_IDENTIFICATION
56 unset LC_MESSAGES
57 unset LC_TELEPHONE
58 unset LC_ALL
59 unset LC_NUMERIC
60 unset LC_MONETARY
61 unset LC_ADDRESS
62 unset LC_PAPER
63
64 export LC_PAPER=A4
65 export LC_MESSAGES=de_DE.UTF-8
66 export LANG=de_DE.UTF-8
67 export LC_CTYPE=de_DE.UTF-8
68 export LANGUAGE=de_DE.UTF-8
69 export LANG=de_DE.UTF-8
70 export LC_ALL=de_DE.UTF-8
71
72 export EDITOR=vim
73
74 # -----/ default pager /-----
75 export PAGER="less"
76
77 # load colors
78 autoload -U colors
79 colors
80
81 # per host color choice
82 case `hostname` in
83 Freigeist*)
84 PROMPTCOLOR=${blue}
85 ;;
86 tweety*)
87 PROMPTCOLOR=${green}
88 ;;
89 enzyan*)
90 PROMPTCOLOR=${purple}
91 ;;
92 esac
93
94 case `whoami` in
95 root)
96 PROMPTRCOLOR=${RED}
97 ;;
98 *)
99 PROMPTRCOLOR=${PROMPTCOLOR}
100 ;;
101 esac
102
103 # -----/ default prompt /-----
104 PROMPT='${BLUE}%~ ${PROMPTCOLOR}->${NC} '
105
106 # -----/ right prompt /-----
107 RPROMPT='${NC}[${PROMPTRCOLOR}%m${NC}${BLACK}${NC}]${ROOT}'
108
109 # -----/ aliases /-----
110 alias mv='nocorrect mv'
111 alias cp='nocorrect cp'
112 alias mkdir='nocorrect mkdir'
113 alias o="if [ $HOST = "enzyan.xxzz.de" ]; then vim /home/sdk/.outl.otl; else vim scp://enzyan/.outl.otl; fi"
114 alias nload='nload -u K -U K'
115 alias mocp='mocp -T darkdot_theme'
116 alias mp3burn='mp3burn -c 080:00 -o "-v speed=24 dev=0,0,0 driveropts=burnproof"'
117 alias cdread='readcd dev=/dev/hda -noerror retries=0 f='
118 alias xbox='lftp ftp://xbox:xbox@192.168.0.40'
119 alias mc='unset RPROMPT && mccolor'
120 alias slrnpull='slrnpull -h news.cnntp.org -d ~/.slrnpull'
121 alias gqview='geeqie'
122 alias update='apt-get update && apt-get -u dist-upgrade && apt-get -t experimental install gimp && apt-get autoremove --purge && apt-get clean'
123 alias chmodme='chmod 740'
124 alias chownme='chown sdk:sdk'
125 alias scpresume='rsync -h --verbose --progress --partial --recursive --compress --compress-level=9 --rsh=ssh'
126
127 alias -g ALL="2>&1"
128 alias -g DN="/dev/null"
129 #alias mplayer='mplayer -softvol -softvol-max 800 -af channels=2 -af pan=2:1:0:0:1:1:0:0:1:0.5:0.5:1:1'
130
131 funced() { vared functions[$1]; }
132 aliased() { vared aliases[$1]; }
133
134 # ---------------------
135
136 # history settings
137 HISTFILE=~/.zshhistory
138 HISTSIZE=3000
139 SAVEHIST=3000
140
141 setopt share_history
142 setopt hist_ignore_dups
143 setopt hist_ignore_space
144
145 autoload -U history-search-end
146 zle -N history-beginning-search-backward-end history-search-end
147 zle -N history-beginning-search-forward-end history-search-end
148 bindkey '^[[A' history-beginning-search-backward-end
149 bindkey '^[[B' history-beginning-search-forward-end
150
151 # Other misc settings
152 LISTMAX=0
153
154 # Make home, insert, delete and end work on PCs basically
155 # like in doskey. This may or may not work for you... the
156 # \e is the ESC character. To set this up for your favourite
157 # system, type cat > rubbish, press the keys of interest,
158 # then enter here what you see. You should replace ^[
159 # (escape) with \e.
160
161 # type the beginning of a command... and press the <up> key!
162 bindkey "^[[A" up-line-or-search
163 bindkey "^[[B" down-line-or-search
164
165 # you often need these...
166 zle -N insert-last-typed-word
167 bindkey "^p" insert-last-typed-word
168 bindkey '^B' insert-last-word
169
170 # move through menus vi-like
171 bindkey -M menuselect 'h' vi-backward-char # left
172 bindkey -M menuselect 'j' vi-down-line-or-history # down
173 bindkey -M menuselect 'k' vi-up-line-or-history # up
174 bindkey -M menuselect 'l' vi-forward-char # right
175 bindkey -M menuselect 'i' accept-and-menu-complete # insert
176
177 # expand *.c to file1.c file2.c ...
178 bindkey "^E" expand-word
179 # keep line, but remove it from bufer
180 bindkey '^K' push-line
181 # shortcut
182 bindkey -s "^F" "ls\n"
183 bindkey '^[[3~' vi-delete-char
184
185 # --------/ Completion stuff /--------
186
187 # ls settings (this is used for completion stuff)
188 # TODO: temp, cuz can't figure out how to not cd to users
189
190 zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
191
192 zstyle ':completion:*:expand:*' accept-exact continue
193 zstyle ':completion:*:cd:*' tag-order local-directories
194 zstyle ':completion:*:scp:*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
195
196 zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns '*.*' loopback localhost
197 zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^*.*' '*@*'
198 zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->' '127.0.0.<->'
199 zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns adm bin daemon halt lp named shutdown sync
200 zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=( ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ } )'
201 zstyle ':completion:*' menu yes=long-list
202 zstyle ':completion:*' menu select=2
203
204 # Expansion options
205 zstyle ':completion:*' completer _complete _prefix
206 zstyle ':completion::prefix-1:*' completer _complete
207 zstyle ':completion:incremental:*' completer _complete _correct
208 zstyle ':completion:predict:*' completer _complete
209
210 # Completion caching
211 zstyle ':completion::complete:*' use-cache 1
212 zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
213
214 # Expand partial paths
215 zstyle ':completion:*' expand 'yes'
216 zstyle ':completion:*' squeeze-slashes 'yes'
217
218 # Include non-hidden directories in globbed file completions
219 # for certain commands
220
221 zstyle ':completion::complete:*' '\'
222
223 # tag-order 'globbed-files directories' all-files
224 zstyle ':completion::complete:*:tar:directories' file-patterns '*~.*(-/)'
225
226 # Don't complete backup files as executables
227 zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'
228
229 # Separate matches into groups
230 zstyle ':completion:*:matches' group 'yes'
231
232 # Describe each match group.
233 zstyle ':completion:*:descriptions' format "%B---- %d%b"
234
235 # Messages/warnings format
236 zstyle ':completion:*:messages' format '%B%U---- %d%u%b'
237 zstyle ':completion:*:warnings' format '%B%U---- no match for: %d%u%b'
238
239 # Describe options in full
240 zstyle ':completion:*:options' description 'yes'
241 zstyle ':completion:*:options' auto-description '%d'
242
243 # }}}
244 # {{{ Simulate my old dabbrev-expand 3.0.5 patch
245
246 zstyle ':completion:*:history-words' stop verbose
247 zstyle ':completion:*:history-words' remove-all-dups yes
248 zstyle ':completion:*:history-words' list false
249
250 zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
251
252 compctl -g "*.tar *.tgz *.tz *.tar.Z *.tar.bz2 *.tZ *.tar.gz" + -g "*(-/) .*(-/)" tar
253
254 compctl -H 0 '' -k hosts telnet ftp ssh host nslookup rup rusers
255 compctl -g "*(-/) .*(-/)" cd rmdir
256
257 ## display fancy terminal title
258 case $TERM in
259 *xterm*|*rxvt*|(u|dt|k|E)term)
260 ## display user@host and full dir in *term title
261 precmd () {
262 print -Pn "\033]0;%m: %~\007"
263 #print -Pn "\033]0;%n@%m%# %~ %l %w :: %T\a" ## or use this
264 }
265 ## display user@host and name of current process in *term title
266 preexec () {
267 print -Pn "\033]0;%m ($1)\007"
268 #print -Pn "\033]0;%n@%m%# <$1> %~ %l %w :: %T\a" ## or use this
269 }
270 ;;
271 esac
272
273 # zsh Options
274
275 # vi mode (vi|emacs)
276 setopt emacs
277
278 setopt \
279 NO_all_export \
280 always_last_prompt \
281 always_to_end \
282 append_history \
283 auto_cd \
284 auto_list \
285 auto_menu \
286 NO_auto_name_dirs \
287 auto_param_keys \
288 auto_param_slash \
289 auto_pushd \
290 auto_remove_slash \
291 NO_auto_resume \
292 bad_pattern \
293 bang_hist \
294 NO_beep \
295 brace_ccl \
296 NO_bsd_echo \
297 cdable_vars \
298 NO_chase_links \
299 NO_clobber \
300 complete_aliases \
301 complete_in_word \
302 NO_correct \
303 NO_correct_all \
304 csh_junkie_history \
305 NO_csh_junkie_loops \
306 NO_csh_junkie_quotes \
307 NO_csh_null_glob \
308 equals \
309 extended_glob \
310 extended_history \
311 function_argzero \
312 glob \
313 NO_glob_assign \
314 glob_complete \
315 NO_glob_dots \
316 glob_subst \
317 hash_cmds \
318 hash_dirs \
319 hash_list_all \
320 hist_allow_clobber \
321 hist_beep \
322 NO_hist_no_store \
323 hist_verify \
324 NO_hup \
325 NO_ignore_braces \
326 NO_ignore_eof \
327 interactive_comments \
328 inc_append_history \
329 NO_list_ambiguous \
330 NO_list_beep \
331 list_types \
332 long_list_jobs \
333 magic_equal_subst \
334 NO_mail_warning \
335 NO_mark_dirs \
336 NO_menu_complete \
337 multios \
338 nomatch \
339 notify \
340 NO_null_glob \
341 numeric_glob_sort \
342 NO_overstrike \
343 path_dirs \
344 posix_builtins \
345 NO_print_exit_value \
346 NO_prompt_cr \
347 prompt_subst \
348 pushd_ignore_dups \
349 pushd_minus \
350 pushd_silent \
351 pushd_to_home \
352 rc_expand_param \
353 NO_rc_quotes \
354 NO_rm_star_silent \
355 sh_file_expansion \
356 sh_option_letters \
357 short_loops \
358 NO_sh_word_split \
359 NO_single_line_zle \
360 NO_sun_keyboard_hack \
361 unset \
362 NO_verbose \
363 zle