#!/usr/bin/env bash # shellcheck disable=SC1090,SC1091 # Prefer US English export LANG="en_US" if [[ "$(hostname)" != *'-minimal' ]]; then export LC_ALL="en_US.UTF-8" fi # Detect support for advanced terminal features if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then export BASH_SUPPORT=true fi ### Import Common Settings if [ -f "$HOME/.config/shell/profile.sh" ]; then . "$HOME/.config/shell/profile.sh" fi ### /etc/bashrc if [ -f /etc/bashrc ]; then . /etc/bashrc fi ### Escape if shell not interactive case $- in *i*) ;; *) return;; esac ### Fig / LC_ALL if [ "$BASH_SUPPORT" = 'true' ]; then if [ -f "$HOME/.fig/shell/bashrc.pre.bash" ]; then . "$HOME/.fig/shell/bashrc.pre.bash" fi fi ### History export HISTFILE="$XDG_STATE_HOME/bash/history" if [ -d "$HISTFILE" ]; then # Remove history file if it is incorrectly created as a directory rm -rf "$HISTFILE" fi ### Bash Initialization Hooks if [ "$BASH_SUPPORT" = 'true' ]; then # Prompt (on bash only) if [[ "$(hostname)" != *'-minimal' ]]; then ### Styled Terminal export BASH_IT="${XDG_DATA_HOME:-$HOME/.local/share}/bash_it" export BASH_IT_THEME="powerline" if command -v powerline-daemon > /dev/null && [ -f "$BASH_IT/bash_it.sh" ]; then . "$BASH_IT/bash_it.sh" elif command -v oh-my-posh > /dev/null; then # Oh My Posh (See: https://ohmyposh.dev/) eval "$(oh-my-posh init bash --config "$XDG_CONFIG_HOME/oh-my-posh/Betelgeuse.omp.json")" else # Basic styled terminal case "$TERM" in xterm* | rxvt* | Eterm | aterm | kterm | gnome* | alacritty) PS1="\n \[\033[0;34m\]╭─\[\033[0;31m\]\[\033[0;37m\]\[\033[41m\] $OS_ICON \u \[\033[0m\]\[\033[0;31m\]\[\033[44m\]\[\033[0;34m\]\[\033[44m\]\[\033[0;30m\]\[\033[44m\] \w \[\033[0m\]\[\033[0;34m\] \n \[\033[0;34m\]╰ \[\033[1;36m\]\$ \[\033[0m\]" ;; esac fi else # Minimal session if command -v oh-my-posh > /dev/null; then eval "$(oh-my-posh init bash --config "$XDG_CONFIG_HOME/oh-my-posh/Betelgeuse-minimal.omp.json")" fi fi ### Bash Completion if [ -f "/usr/local/etc/profile.d/bash_completion.sh" ]; then . "/usr/local/etc/profile.d/bash_completion.sh" fi ### Bash Completion (Homebrew) if command -v brew > /dev/null; then if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then . "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" else for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*; do [[ -r "${COMPLETION}" ]] && source "${COMPLETION}" done fi fi ### Atuin if command -v atuin > /dev/null; then eval "$(atuin init bash)" fi ### Cod if command -v cod > /dev/null; then . <(cod init $$ bash) fi ### Google Cloud SDK if [ -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.bash.inc" ]; then . "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.bash.inc" fi ### direnv if command -v direnv > /dev/null; then eval "$(direnv hook bash)" fi ### Emplace if command -v emplace > /dev/null; then . <(emplace init bash) fi ### iTerm2 if [ -f "$HOME/.local/scripts/iterm2.bash" ]; then . "$HOME/.local/scripts/iterm2.bash" fi ### Java (asdf) if [ -f "$ASDF_DATA_DIR/plugins/java/set-java-home.bash" ]; then . "$ASDF_DATA_DIR/plugins/java/set-java-home.bash" fi ### Fig if [ -f "$HOME/.fig/shell/bashrc.post.bash" ]; then . "$HOME/.fig/shell/bashrc.post.bash" fi ### Navi (Ctrl+G) if command -v navi > /dev/null; then eval "$(navi widget bash)" fi ### The Fuck if command -v thefuck > /dev/null; then eval "$(thefuck --alias)" fi ### Vault if command -v vault > /dev/null; then complete -C vault vault fi ### zoxide if command -v zoxide > /dev/null; then eval "$(zoxide init --cmd cd bash)" fi fi