# vim: filetype=zsh

[[ -d "${HISTFILE:h}" ]] || mkdir -p "${HISTFILE:h}"

add_path() {
  [[ -d "$1" ]] && path=("$1" $path)
}

add_path "$HOME/.cargo/bin"
add_path "$HOME/.local/bin"

case "$OSTYPE" in
  darwin*)
    add_path "/opt/homebrew/bin"
    add_path "$HOME/.local/venv/nvim"
    ;;
  freebsd*)
    add_path "$HOME/.local/texlive/bin/amd64-freebsd"
    ;;
esac

export MANPATH="${MANPATH:-$(manpath)}:$NPM_PACKAGES/share/man:$HOME/.local/texlive/texmf-dist/man"
export INFOPATH="$INFOPATH:$HOME/.local/texlive/texmf-dist/info"

# Fix für include/lib Verzeichnisse
# Details: https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html
export C_INCLUDE_PATH="/usr/local/include:$C_INCLUDE_PATH"
export CPLUS_INCLUDE_PATH="/usr/local/include:$CPLUS_INCLUDE_PATH"
export LIBRARY_PATH="/usr/local/lib:$LIBRARY_PATH"

# Fix Midnight Commander ESC Taste
# zusätzlich noch unter "F9 -> Optionen -> Konfiguration -> Escape Tastenmodus -> [x] Einzelner Tastendruck" aktivieren
export KEYBOARD_KEY_TIMEOUT_US=1000

# Tmuxp
# https://tmuxp.git-pull.com/configuration/environmental-variables.html
export TMUXP_CONFIGDIR="$XDG_CONFIG_HOME/tmuxp"

# Vit (Taskwarrior UI)
# https://github.com/vit-project/vit/blob/2.x/CUSTOMIZE.md
export VIT_DIR="$XDG_CONFIG_HOME/vit"

# Maildir für mu (mail-utils)
export MAILDIR="$HOME/Mail"

# mpd starten
if [[ -x /usr/local/bin/musicpd ]] && ! pgrep "musicpd" > /dev/null; then
  /usr/local/bin/musicpd
fi

