# Setup starship shell integration (bash, zsh, and fallback paths) _setup_starship() { # Ensure starship binary is accessible if installed in common locations if ! command -v starship >/dev/null 2>&1; then for _starship_bin_dir in \ "/opt/homebrew/bin" \ "/usr/local/bin" \ "$HOME/.starship/bin" \ "$HOME/.local/bin" do if [ -x "$_starship_bin_dir/starship" ]; then case ":$PATH:" in *":$_starship_bin_dir:"*) ;; *) PATH="$_starship_bin_dir:$PATH"; export PATH ;; esac break fi done fi command -v starship >/dev/null 2>&1 || return 0 if [ -n "$BASH_VERSION" ]; then if starship init bash >/dev/null 2>&1; then eval "$(starship init bash)" else # Fallback for older starship versions for _dir in \ "/opt/homebrew/opt/starship/shell" \ "/usr/local/opt/starship/shell" \ "$HOME/.starship/shell" \ "/usr/share/doc/starship/examples" \ "/usr/share/starship" do if [ -d "$_dir" ]; then [ -r "$_dir/completion.bash" ] && \. "$_dir/completion.bash" [ -r "$_dir/key-bindings.bash" ] && \. "$_dir/key-bindings.bash" break fi done fi elif [ -n "$ZSH_VERSION" ]; then if starship init zsh >/dev/null 2>&1; then eval "$(starship init zsh)" else # Fallback for older starship versions for _dir in \ "/opt/homebrew/opt/starship/shell" \ "/usr/local/opt/starship/shell" \ "$HOME/.starship/shell" \ "/usr/share/doc/starship/examples" \ "/usr/share/starship" do if [ -d "$_dir" ]; then [ -r "$_dir/completion.zsh" ] && \. "$_dir/completion.zsh" [ -r "$_dir/key-bindings.zsh" ] && \. "$_dir/key-bindings.zsh" break fi done fi fi } _setup_starship unset -f _setup_starship