.dotfiles/bash/.bash_profile
2024-12-18 20:51:10 -05:00

77 lines
2.4 KiB
Bash
Executable file

# Ensure XDG_CONFIG_HOME is set
: "${XDG_CONFIG_HOME:=$HOME/.config}"
# Set default pager
export PAGER="less -i -N -S -R"
# Ensure PYENV_ROOT is set and its bin directory is in PATH
if [ -n "$PYENV_ROOT" ] && [[ ! "$PATH" =~ (^|:)${PYENV_ROOT}/bin(:|$) ]]; then
export PATH="$PYENV_ROOT/bin:$PATH"
fi
eval "$(pyenv init -)"
# Add ~/.local/bin to PATH if it exists
if [ -d "$HOME/.local/bin" ] && [[ ! "$PATH" =~ (^|:)${HOME}/.local/bin(:|$) ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
# Set permissions for ~/.local/bin
chmod -R ug+rwx "$HOME/.local/bin/"
# Read fzf theme options if the file exists
if [ -f "$HOME/.local/bin/scripts/fzf_theme" ]; then
FZF_OPTIONS=$("$HOME/.local/bin/scripts/fzf_theme")
export FZF_DEFAULT_OPTS="$FZF_OPTIONS"
fi
# Source fzf configuration
if command -v fzf >/dev/null 2>&1; then
eval "$(fzf --bash)"
fi
[ -f ~/.fzf.bash ] && . ~/.fzf.bash
# Add RVM to PATH if not already included
if [[ ! "$PATH" =~ (^|:)${HOME}/.rvm/bin(:|$) ]]; then
export PATH="$PATH:$HOME/.rvm/bin"
fi
# Add Golang to PATH if not already included
if [ -n "$(go env GOPATH)" ] && [[ ! "$PATH" =~ (^|:)$(go env GOPATH)/bin(:|$) ]]; then
export GOPATH="$HOME/Documents/projects:$HOME/go"
export PATH="$PATH:$(go env GOPATH)/bin"
fi
# Cargo setup
if [ -d "$HOME/.cargo/bin" ] && [[ ! "$PATH" =~ (^|:)${HOME}/.cargo/bin(:|$) ]]; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/local/Caskroom/miniforge/base/bin/conda' 'shell.bash' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/usr/local/Caskroom/miniforge/base/etc/profile.d/conda.sh" ]; then
. "/usr/local/Caskroom/miniforge/base/etc/profile.d/conda.sh"
else
export PATH="/usr/local/Caskroom/miniforge/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# Check for WSL and adjust configurations
if grep -q Microsoft /proc/version; then
# Ensure WSL compatibility for Conda if using Miniforge
if [ -f "/mnt/c/Users/$USER/AppData/Local/Miniconda3/etc/profile.d/conda.sh" ]; then
. "/mnt/c/Users/$USER/AppData/Local/Miniconda3/etc/profile.d/conda.sh"
fi
else
# Unix-specific configuration (Linux/macOS)
# Add any Unix-specific paths or configurations here
export PATH="/usr/local/bin:$PATH"
fi