initial
[zsh.git] / .zsh / .zshrc
1 # -*- mode: sh;-*-
2 ############
3 #
4 # .zshrc
5 # Written by Joerg Jaspert <joerg@debian.org>
6 #
7 ############
8
9 # Base directory for all plugins, themes, functions, whatever
10 ZSH=${HOME}/.zsh
11
12 debug ()
13 {
14 [ "${DEBUG}" = "no" ] && return
15 msg=${1:-""}
16 nl=${2:-""}
17 echo ${nl} "${msg}$reset_color"
18 }
19
20 debug "Starting zsh"
21 # Want to use colors in log output...
22 autoload -U colors && colors
23
24
25 # Most of my config is splitted into files and directories
26 if [ -d ${ZDOTDIR} ]; then
27 for script in ${ZDOTDIR}/??_*.zsh; do
28 debug "Loading ${${script:t:r}/??_/}... " -n
29 source $script
30 debug "$fg_no_bold[green]done"
31 for i in "net:$DOMAIN" \
32 "host:$HOST" \
33 "sys:$OSNAME" \
34 "distri:$DISTRI" \
35 "user:$USER" \
36 "user:$SUDO_USER" \
37 "net:$DOMAIN/host:$HOST" \
38 "net:$DOMAIN/sys:$OSNAME" \
39 "net:$DOMAIN/distri:$DISTRI" \
40 "net:$DOMAIN/user:$USER" \
41 "net:$DOMAIN/user:$SUDO_USER" \
42 "net:$DOMAIN/host:$HOST/sys:$OSNAME" \
43 "net:$DOMAIN/host:$HOST/distri:$DISTRI" \
44 "net:$DOMAIN/host:$HOST/user:$USER" \
45 "net:$DOMAIN/host:$HOST/user:$SUDO_USER" \
46 "net:$DOMAIN/host:$HOST/sys:$OSNAME" \
47 "net:$DOMAIN/host:$HOST/sys:$OSNAME/distri:$DISTRI" \
48 "net:$DOMAIN/host:$HOST/sys:$OSNAME/user:$USER" \
49 "net:$DOMAIN/host:$HOST/sys:$OSNAME/user:$SUDO_USER" \
50 "host:$HOST/sys:$OSNAME" \
51 "host:$HOST/distri:$DISTRI" \
52 "host:$HOST/user:$USER" \
53 "host:$HOST/user:$SUDO_USER" \
54 "host:$HOST/sys:$OSNAME/distri:$DISTRI" \
55 "host:$HOST/sys:$OSNAME/user:$USER" \
56 "host:$HOST/sys:$OSNAME/user:$SUDO_USER"
57 do
58 specific_script=${script:h}/$i/${${script:t}/??_/}
59 #debug "Checking $specific_script... "
60 if [ -r ${specific_script} ]; then
61 debug "Loading $i/${${specific_script:t:r}/??_/}... " -n
62 source ${specific_script}
63 debug "$fg_no_bold[green]done"
64 fi
65 done
66 done
67 fi
68
69 # For sudo shells
70 if [ ! -z "$SUDO_USER" ]; then
71 export HOME=~$USER
72 [ "`pwd`" = ~$SUDO_USER ] && cd
73 fi