adjust path entries
[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
21 # Local settings and styles can go here and (usually) overwrite
22 # things defined by me later.
23 [[ -f ${ZDOTDIR}/zshenv.local ]] && source ${ZDOTDIR}/zshenv.local
24
25 DEBUG=${DEBUG:-no}
26
27 # Path to search for autoloadable functions.
28 fpath=( $HOME/.zsh/functions $HOME/zsh "$fpath[@]" )
29 # Only unique entries please.
30 typeset -U fpath
31 fpath=( ${^fpath}(N-/) )
32 export fpath
33
34 # Include function path in script path so that we can run them even
35 # though a subshell may not know about functions.
36 # PATH should already be exported, but in case not. . .
37 path=(
38 "$lpath[@]"
39 /usr/local/bin
40 /bin
41 /usr/bin
42 /usr/X11/bin
43 /usr/bin/X11
44 /usr/local/X11/bin
45 /usr/local/games
46 /usr/games
47 /usr/lib/nagios/plugins
48 "$fpath[@]"
49 "$path[@]"
50 "$PATH[@]"
51 )
52 if [ "`id -u`" = "0" ] || ! [ -x /usr/bin/id ]; then
53 path=(
54 "$path[@]"
55 /usr/local/sbin
56 /usr/sbin
57 /sbin
58 )
59 fi
60
61 manpath=(
62 "$lmanpath[@]"
63 /usr/share/man
64 /usr/local/share/man
65 "$manpath[@]"
66 )
67
68 # Only unique entries please.
69 typeset -gU path
70 typeset -gU manpath
71
72 # Remove entries that don't exist on this system. Just for sanity's
73 # sake more than anything.
74 path=( ${^path}(N-/) )
75 manpath=( ${^manpath}(N-/) )
76
77 # Command to use when redirecting from/to a null command.
78 # READNULLCMD is redefined in .zshrc for interactive shells.
79 READNULLCMD=cat
80 NULLCMD=cat
81
82 # Unix groups: remember the original group ID. (For prompts.)
83 if [[ ${+ORIGGID} -eq 0 ]]; then
84 export ORIGGID="$GID"
85 fi
86
87 # Just to make damn sure they are there.
88 export PATH USER HOST DOMAIN UID OSNAME DISTRI