# vim: ft=sh # # 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 elif (( $+commands[xdg-open] )); then export BROWSER=xdg-open fi # # Editors # if (( $+commands[nvim] )); then export EDITOR=nvim export VISUAL=nvim else export EDITOR=vim export VISUAL=vim fi 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=( $HOME/.local/bin $DOTFILES/bin $HOME/junest/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 # # SSH # if (( $+commands[systemctl] )); then eval "$(systemctl --user show-environment | grep '^SSH_AUTH_SOCK=')" fi if [ -n $SSH_AUTH_SOCK -a -f "$XDG_RUNTIME_DIR/ssh-agent.sock" ]; then SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.sock" fi export SSH_AUTH_SOCK # # Arch Build system # export ASPROOT=$HOME/aur/ABS/.asp # # LaTeX # export TEXMFHOME=$DOTFILES/texmf # # Local overrides # [[ -e "$DOTFILES/zsh/zprofile.local" ]] && source "$DOTFILES/zsh/zprofile.local"