#!/bin/zsh
# ====================[ zenv                               ]====================
#                     [ Time-stamp: "2009-04-18 19:29:24 leycec" ]
#
# This file aggregates all environment variables into one file. Customarily,
# Gentoo disaggregates all environment variables into the "/etc/env.d/" path,
# from which it then dynamically constructs the "/etc/profile.env" file, which
# this file sources. I find that to be a rather clumsy and overly abstracted
# means for defining environment variables, however; I prefer this.

# Load environment settings from profile.env, which is created by
# env-update from the files in /etc/env.d
[ -e /etc/profile.env ] && source /etc/profile.env

# ....................{ PATHS                              }....................
# Set up PATH depending on whether we're root or a normal user.
# There's no real reason to exclude sbin paths from the normal user,
# but it can make tab-completion easier when they aren't in the
# user's PATH to pollute the executable namespace.
#
# It is intentional in the following line to use || instead of -o.
# This way the evaluation can be short-circuited and calling whoami is
# avoided.
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
  export PATH="/usr/lib/colorgcc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/bin:${ROOTPATH}"
else
  export PATH="/usr/lib/colorgcc/bin:/usr/local/bin:/usr/bin:/bin:${PATH}"
fi
unset ROOTPATH

# Add "$HOME/bin/" to the PATH, if that path exists.
[ -d "$HOME/bin" ] && export PATH="$PATH:$HOME/bin"

# Read X.Org application defaults from this path.
export XAPPLRESDIR="${HOME}/.X"
export XUSERFILESEARCHPATH="${XAPPLRESDIR}/%N"

# Set the ZSH cache path, and make that path if it does not already exist.
# ZSH, itself, is unaware of this path. We find it convenient, nonetheless, to
# centralize ZSH caches into this path.
         ZSH_DOT_HOME="${HOME}/.zsh"
[ ! -d ${ZSH_DOT_HOME} ] && mkdir ${ZSH_DOT_HOME}

# ....................{ *NIX                               }--------------------
# Enable Unicode support.
export LANG="en_US.utf8"
export LC_ALL="en_US.utf8"

# Select a default command-line editor and pager.
export EDITOR="/usr/bin/vim"
export PAGER="/usr/bin/less"

# ....................{ GENTOO                             }--------------------
# Reduce Paludis and Inquisitio verbosity and "upgrade eagerness."
export INQUISITIO_OPTIONS="\
--log-level warning \
--matcher pcre \
--show-dependencies"
export PALUDIS_OPTIONS="\
--continue-on-failure if-independent \
--dl-blocks accumulate \
--dl-circular error \
--dl-downgrade warning \
--dl-new-slots always \
--dl-reinstall never \
--dl-reinstall-scm never \
--dl-reinstall-targets auto \
--dl-suggested install \
--dl-upgrade always \
--log-level warning \
--show-reasons summary \
--show-use-descriptions changed \
--show-package-descriptions new \
--with-unused-dependencies"

# ....................{ ZSH                                }....................
# Enable an in-memory cache of ZSH history; persist this history to some file.
export HISTSIZE=1024  # maintain this number of lines of history
export SAVEHIST=1024  # ..retain this number of lines of history between logins
export HISTFILE="${ZSH_DOT_HOME}/history"

# ....................{ NET                                }--------------------
# Disable Firefox's Pango-enabled font antialiasing on low-resource machines.
export MOZ_DISABLE_PANGO=1

# Enable SSH over non-anonymous (i.e., non-pserver) CVS.
export CVS_RSH=ssh

# ....................{ TEX                                }--------------------
# Locate user-specific "TeX" trees at this user-specific path. This variable
# defaults to "~/texmf/" in "/etc/texmf/texmf.d/05searchpaths.cnf", which as
# defaults go is rather clumsy. Thus, this. (Environment variables of the same
# name take precedence over "/etc/texmf/web2c/texmf.cnf" variables and also do
# not require updating on change. So, this is an elegant solution. Somewhat.)
#
# User-specific "TeX" trees should have directory structure resembling that of
# system-specific "TeX" trees (e.g., "/usr/share/texmf-dist/") but probably not.
# the overarching "TeX" tree at "/usr/share/texmf/".
export TEXMFHOME="$HOME/share/texmf"

# --------------------( COPYRIGHT AND LICENSE              )--------------------
# The information below applies to everything in this distribution,
# except where noted.
#              
# Copyleft 2007, 2008, and 2009 by B.w.Curry.
#   
#   http://www.raiazome.com
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
