# ============================================================================= # 1. HELPER FUNCTIONS & PATH # ============================================================================= source_if_readable() { local file="$1" if [[ -f "$file" && -r "$file" ]]; then source "$file" fi } # Ensure local bin is in PATH early (catches manual Starship installations) export PATH="$HOME/.local/bin:$PATH" # ============================================================================= # 2. THIRD-PARTY INITIALIZATION & CUSTOM CONFIGS # ============================================================================= # Load external initializers (SDKMAN, NVM, etc.) source_if_readable "$HOME/.sourcerc" # Custom Functions (must load before Path Management) source_if_readable "$HOME/.func" # Path Management (Relies on append_path from .func) source_if_readable "$HOME/.pathrc" # Aliases (Loaded late so they override system defaults) source_if_readable "$HOME/.alias" # ============================================================================= # 3. STARSHIP PROMPT # ============================================================================= if [[ -z "${STARSHIP_CONFIG:-}" && -f "$HOME/.config/starship.toml" ]]; then export STARSHIP_CONFIG="$HOME/.config/starship.toml" fi # Cleanly initialize Starship checking both system and local paths if command -v starship >/dev/null 2>&1; then eval "$(starship init zsh)" elif [[ -f "$HOME/.local/bin/starship" ]]; then eval "$($HOME/.local/bin/starship init zsh)" fi # ============================================================================= # 4. PLUGINS (Loaded directly from ~/.zsh) # ============================================================================= # Autosuggestions source_if_readable "$HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" # Syntax Highlighting (CRITICAL: Must be the absolute last thing loaded) source_if_readable "$HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"