Dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

107 lines
2.4 KiB

#
# Executes commands in every top-level shell
#
# ATTENTION: This differs from usual zsh behaviour!
# Treat this file as a per-session zshenv instead.
#
# Why is this useful? Because it only gets executed once for any given tree
# of zsh-processes. You can use it to do environment computations that would
# be too expensive for zshenv.
#
# Then why also source it in non-interactive shells?
# Because it prevents desync between scripts and interactive prompts.
# Ever tried to debug a script and ended up with "But it works in the prompt!"?
#
# That is especially true with X11-Scenarios, since a display-manager usually
# doesn't source any profile. Which will lead to shells without a login shell in
# their parent process tree, which means the profile is basically useless.
#
# If you need loginshell-only commands, use zlogin instead. If you insist on
# zprofile, create a .zprofile (note the dot) file in this directory and zsh will
# treat it as always.
#
#
# Browser
#
if [[ "$OSTYPE" == darwin* ]]; then
export BROWSER='open'
fi
#
# Editors
#
export EDITOR='vim'
export VISUAL='vim'
export PAGER='less'
#
# Language
#
if [[ -z "$LANG" ]]; then
export LANG='en_US.UTF-8'
fi
#
# Paths
#
# Set the the list of directories that cd searches.
# cdpath=(
# $cdpath
# )
# Set the list of directories that Zsh searches for programs.
path=(
$DOTFILES/bin
$HOME/.local/bin
$HOME/bin
/usr/local/{bin,sbin}
$path
)
# Set the list of directories that Python searches for modules.
pythonpath=(
$DOTFILES/lib/python
"${(@s|:|)PYTHONPATH}"
)
# Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath mailpath path pythonpath
# zsh only maps the array and text versions for PATH
export PYTHONPATH="${(j|:|)pythonpath}"
#
# Less
#
# Set the default Less options.
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing).
# Remove -X and -F (exit if the content fits on one screen) to enable it.
export LESS='-F -g -i -M -R -S -w -X -z-4'
# Set the Less input preprocessor.
if (( $+commands[lesspipe.sh] )); then
export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-'
fi
#
# Temporary Files
#
if [[ ! -d "$TMPDIR" ]]; then
export TMPDIR="/tmp/$UID"
mkdir -p -m 700 "$TMPDIR"
fi
TMPPREFIX="${TMPDIR%/}/zsh"
if [[ ! -d "$TMPPREFIX" ]]; then
mkdir -p "$TMPPREFIX"
fi
# Local overrides
[[ -e "$DOTFILES/zsh/zprofile.local" ]] && source "$DOTFILES/zsh/zprofile.local"