in case the user doesn't symlink but copy the zshenv.home file,
[zsh.git] / .zsh / zshenv.home
1 # -*- mode: sh;-*-
2 ############
3 #
4 # .zshenv
5 # Written by Joerg Jaspert <joerg@debian.org>
6 #
7 ############
8 # This assumes that $HOME/.zshenv is a symlink to
9 # $ZDOTDIR/zshenv.home (as is my default).
10 if zp=$(readlink -f ${HOME}/.zshenv 2>/dev/null); then
11 zp=${zp%/*}
12 elif zp=$(greadlink -f ${HOME}/.zshenv 2>/dev/null); then
13 # MacOS readlink isn't up to the task, user needs to
14 # install the gnu coreutils for it
15 zp=${zp%/*}
16 else
17 # If both fail, use the "traditional" way of hardcoding
18 zp="${HOME}/.zsh"
19 fi
20 ZDOTDIR=${ZDOTDIR:-$zp}
21 # In case the user did not symlink us, but copy, we fallback to
22 # the traditional way too.
23 if [[ ${HOME} == ${ZDOTDIR} ]]; then
24 ZDOTDIR="${HOME}/.zsh"
25 fi
26
27 [ -r "${ZDOTDIR}/zshenv" ] && source "${ZDOTDIR}/zshenv"
28
29 # If you want to "profile" the shell initialization, enable
30 # the following lines.
31 # Don't have this enabled for normal use, its pretty distracting and
32 # also changes some initialization behaviour (re prompts)
33
34 ## Set the trace prompt to be like
35 ## YYYY-MM-DD HH:MM:SS scriptname(function):line>
36 #PS4='%D{%Y-%m-%d %H:%M:%S} %x(%N):%i> '
37 ## save file stderr to file descriptor 3 and redirect stderr (including trace
38 ## output) to a tempfile
39 #INITLOG=$(mktemp --tmpdir=/tmp zshlog.XXXXX.${USER}.$(date +%s))
40 #exec 3>&2 2>${INITLOG}
41 ## set options to turn on tracing and expansion of commands contained in the prompt
42 #setopt xtrace prompt_subst
43
44 # Store "starttime" of shell in case user wants to see how long loading took
45 _start_time=$(( $(( $(date +%s) * 1000000000 )) + $(date +%N) ))
46 # Variable is removed on end of shell load
47
48 # Don't do anything more in here, do everything inside
49 # $ZDOTDIR!