# ============================================================================ # Environment Variables # ============================================================================ # XDG Base Directories export XDG_DATA_HOME="$HOME/.local/share" export XDG_CONFIG_HOME="$HOME/.config" export XDG_STATE_HOME="$HOME/.local/state" export XDG_CACHE_HOME="$HOME/.cache" export XDG_BIN_HOME="$HOME/.local/bin" export XDG_BIN_DIR="$XDG_BIN_HOME" # Moving dotfiles around export WINEPREFIX="$XDG_DATA_HOME/wine" export WORKON_HOME="$XDG_DATA_HOME/virtualenvs" export SQLITE_HISTORY="$XDG_CACHE_HOME/sqlite_history" export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle" export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle" export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle" export NUGET_PACKAGES="$XDG_CACHE_HOME/NuGetPackages" export DVDCSS_CACHE="$XDG_DATA_HOME/dvdcss" export KDEHOME="$XDG_CONFIG_HOME/kde" export GOPATH="$XDG_DATA_HOME/go" export ZIM_HOME="$XDG_CONFIG_HOME/.zim" export GHCUP_USE_XDG_DIRS="ishouldjustbeabletoexportthisnotsetit" export NODE_PATH="$XDG_DATA_HOME/npm-packages/lib/node_modules" export CARGO_HOME="$XDG_DATA_HOME/cargo" export ASDF_DATA_DIR="$XDG_DATA_HOME/asdf" # pi coding agent export PI_CODING_AGENT_DIR="$XDG_CONFIG_HOME/pi" # Android SDK export ANDROID_HOME="$XDG_DATA_HOME/Android" export ANDROID_SDK_ROOT="$ANDROID_HOME" # ============================================================================ # PATH Configuration # ============================================================================ # Prepend paths in reverse order (last becomes first in PATH) path_prepend() { case ":$PATH:" in *":$1:"*) :;; # already in PATH *) PATH="$1${PATH:+:$PATH}" ;; esac } # XDG_BIN_HOME takes highest priority path_prepend "$XDG_BIN_HOME" path_prepend "$XDG_CACHE_HOME/.bun/bin" path_prepend "$HOME/.radicle/bin" path_prepend "$XDG_DATA_HOME/cargo/bin" path_prepend "$GOPATH/bin" path_prepend "$XDG_CONFIG_HOME/emacs/bin" path_prepend "/usr/local/go/bin" path_prepend "/usr/lib/kf5" path_prepend "/usr/lib/kf6" # Android SDK paths path_prepend "$ANDROID_HOME/emulator" path_prepend "$ANDROID_HOME/platform-tools" path_prepend "$ANDROID_HOME/cmdline-tools/latest/bin" # Guix export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale" export GUIX_PROFILE="$HOME/.guix-profile" path_prepend "$GUIX_PROFILE/bin" # ============================================================================ # Preferences and Tools # ============================================================================ export BAT_THEME="ansi" export DFT_BACKGROUND="light" {{ if eq .chezmoi.hostname "sidhe" }} export EDITOR="zed --wait" {{ else }} export EDITOR="zeditor --wait" {{ end }} export VISUAL="$EDITOR" export MANPAGER="nvim +Man!" export COLUMNS=80 export MANWIDTH=80 export RIPGREP_CONFIG_PATH="$HOME/.config/ripgreprc" export RANGER_LOAD_DEFAULT_RC=false # Disable Python keyring export PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring" # mise if command -v mise &> /dev/null; then eval "$(mise activate bash)" fi # secrets (fnox) if [[ -f "$XDG_CONFIG_HOME/fnox/age.txt" ]]; then export FNOX_AGE_KEY=$(grep "AGE-SECRET-KEY" "$XDG_CONFIG_HOME/fnox/age.txt") if command -v fnox &> /dev/null; then {{ if eq .chezmoi.username "exedev" }} # Load secrets immediately for non-interactive shells (e.g., agents) eval "$(mise exec fnox@latest -- fnox hook-env -s bash 2>/dev/null || true)" {{ end }} eval "$(mise exec fnox@latest -- fnox activate bash 2>/dev/null || true)" fi fi # ============================================================================ # History Configuration # ============================================================================ # Don't put duplicate lines or lines starting with space in the history HISTCONTROL=ignoreboth # Append to the history file, don't overwrite it shopt -s histappend # History size HISTSIZE=10000 HISTFILESIZE=20000 # Save history to XDG location export HISTFILE="$XDG_STATE_HOME/bash/history" mkdir -p "$(dirname "$HISTFILE")" # ============================================================================ # Shell Options # ============================================================================ # Check window size after each command and update LINES/COLUMNS shopt -s checkwinsize # Enable ** globstar (if available) shopt -s globstar 2>/dev/null # Enable programmable completion if ! shopt -oq posix; then if [[ -f /usr/share/bash-completion/bash_completion ]]; then source /usr/share/bash-completion/bash_completion elif [[ -f /etc/bash_completion ]]; then source /etc/bash_completion fi fi # ============================================================================ # Aliases # ============================================================================ {{ if ne .chezmoi.hostname "sidhe" }} alias zed="zeditor" {{ end }} alias wget="wget --hsts-file=\"$XDG_DATA_HOME/wget-hsts\"" alias svn="svn --config-dir $XDG_CONFIG_HOME/subversion" alias ts="tailscale" alias datetime="date +%Y-%m-%d_%H%M%S_%Z" alias clip="xclip -selection clipboard" alias send="rsync -amzzP" alias bat="bat -n --tabs 2" alias erase="shred -vzfun 32" alias dl="yt-dlp --write-sub --write-auto-sub --sub-lang en --sub-format srt/best --convert-subs srt --embed-subs -o '%(upload_date)s %(title)s.%(ext)s'" alias us="unsilence -t 15 -as 1.25" alias sxiv="sxiv -p" alias c="chezmoi" alias t="tuios" alias ls="lsd" alias soft="ssh git.secluded.site" alias g="git" # Modern replacements alias ll='ls -la' alias la='ls -a' # ============================================================================ # Functions # ============================================================================ # cheat.sh integration cht() { if [[ $# -eq 0 ]]; then echo "Usage: cht or cht /" return 1 fi curl -s "cheat.sh/$*" } # ============================================================================ # Tool Integrations # ============================================================================ # Starship prompt if command -v starship &> /dev/null; then eval "$(starship init bash)" fi # Atuin history if command -v atuin &> /dev/null; then eval "$(atuin init bash --disable-up-arrow)" fi # Completions (if available) for cmd in lune tuios crush lx; do if command -v "$cmd" &> /dev/null; then eval "$("$cmd" completion bash 2>/dev/null || true)" fi done