#!/bin/sh

export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"

# Default editor
export EDITOR='vim'

# Shell history (env vars both shells read; each ignores the other's by name —
# zsh uses SAVEHIST, bash uses HISTFILESIZE/HISTCONTROL. zsh dedup is a setopt,
# not an env var, so it stays in .zshrc).
export HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/shell/history"
export HISTSIZE=1000000        # commands kept in memory (both shells)
export SAVEHIST=1000000        # zsh: lines written to $HISTFILE
export HISTFILESIZE=1000000    # bash: lines written to $HISTFILE
export HISTCONTROL=ignoreboth  # bash: drop dups + space-prefixed

# Global git config file
export GIT_CONFIG_GLOBAL="${XDG_CONFIG_HOME:-$HOME/.config}/git/config"

# Make Python use UTF-8 encoding for output to stdin, stdout, and stderr.
export PYTHONIOENCODING='UTF-8'

# Python commands in that file are executed before the first prompt is displayed in interactive mode.
# The file is executed in the same namespace where interactive commands are executed
# so that objects defined or imported in it can be used without qualification in the interactive session.
export PYTHONSTARTUP="${XDG_CONFIG_HOME:-$HOME/.config}/python/startup"

# Custom Python history file
export PYTHON_HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/python/history"

# Pyenv root:
[ -x "$(command -v pyenv)" ] && export PYENV_ROOT="$HOME/.pyenv"

# PostgreSQL config file
[ -x "$(command -v psql)" ] && export PSQLRC="${XDG_CONFIG_HOME:-$HOME/.config}/psql/rc"

# Wget config file
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/rc"

# Readline config file (bash line editing + any readline program)
export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/readline/inputrc"

# NOTE: ZDOTDIR lives in ~/.zshenv, not here. It must be set before zsh reads
# any rc file, and this file is sourced too late for that.
