Move into an external dir
[zsh.git] / .zsh / zshenv
1 # -*- mode: sh;-*-
2 ############
3 #
4 # .zshenv
5 # Written by Joerg Jaspert <joerg@debian.org>
6 #
7 ############
8
9 # We (may) use those variables wherever, so fill them now.
10 # Avoids calling the processes all the time we need em.
11 OSNAME=`uname -s`
12 USER=${USER:-`whoami`}
13 UID=${UID:-`id -u`}
14 # :r strips "extension" (a . followed by 0 or more characters)
15 HOST=$HOST:r:r
16 HOST=${HOST:-$(hostname -s)}
17 DOMAIN=${DOMAIN:-$(hostname -d 2>&-)}
18 [ "$DOMAIN" = "" -o "$DOMAIN" = "localdomain" -o "$DOMAIN" = "(none)" ] && DOMAIN=$(grep "^search " /etc/resolv.conf | cut -d' ' -f2)
19 [[ -f /etc/debian_version ]] && DISTRI="Debian"
20 [[ -f /etc/redhat-release ]] && DISTRI="RedHat"
21
22 # Local settings and styles can go here and (usually) overwrite
23 # things defined by me later.
24 [[ -f ${ZDOTDIR}/zshenv.local ]] && source ${ZDOTDIR}/zshenv.local
25
26 DEBUG=${DEBUG:-no}
27
28 # In case the user wants oh-my-zsh plugins, we add their path to the
29 # fpath, as they often have completion functions.
30 typeset -a ompath
31 if [[ -d ${ZDOTDIR}/plugins/ohmy ]]; then
32 local -a omplug
33 zstyle -a ':ganneff:config' ohmyplugins omplug
34 for plug in ${omplug}; do
35 if [[ -f ${ZDOTDIR}/plugins/ohmy/${plug}/${plug}.plugin.zsh ]]; then
36 ompath+=(${ZDOTDIR}/plugins/ohmy/${plug})
37 fi
38 done
39 fi
40 unset omplug
41
42 # Path to search for autoloadable functions.
43 fpath=( ${ZDOTDIR}/functions $ompath[@] $fpath[@] )
44 unset ompath
45
46 # Only unique entries please.
47 typeset -U fpath
48 fpath=( ${^fpath}(N-/) )
49 export fpath
50
51 # Include function path in script path so that we can run them even
52 # though a subshell may not know about functions.
53 # PATH should already be exported, but in case not. . .
54 path=(
55 "$lpath[@]"
56 /usr/local/bin
57 /bin
58 /usr/bin
59 /usr/X11/bin
60 /usr/bin/X11
61 /usr/local/X11/bin
62 /usr/local/games
63 /usr/games
64 /usr/lib/nagios/plugins
65 "$fpath[@]"
66 "$path[@]"
67 "$PATH[@]"
68 )
69 if [ "`id -u`" = "0" ] || ! [ -x /usr/bin/id ]; then
70 path=(
71 "$path[@]"
72 /usr/local/sbin
73 /usr/sbin
74 /sbin
75 )
76 fi
77
78 manpath=(
79 "$lmanpath[@]"
80 /usr/share/man
81 /usr/local/share/man
82 "$manpath[@]"
83 )
84
85 # Only unique entries please.
86 typeset -gU path
87 typeset -gU manpath
88
89 # Remove entries that don't exist on this system. Just for sanity's
90 # sake more than anything.
91 path=( ${^path}(N-/) )
92 manpath=( ${^manpath}(N-/) )
93
94 # Command to use when redirecting from/to a null command.
95 # READNULLCMD is redefined in .zshrc for interactive shells.
96 READNULLCMD=cat
97 NULLCMD=cat
98
99 # Unix groups: remember the original group ID. (For prompts.)
100 if [[ ${+ORIGGID} -eq 0 ]]; then
101 export ORIGGID="$GID"
102 fi
103
104 # Just to make damn sure they are there.
105 export PATH USER HOST DOMAIN UID OSNAME DISTRI