Files
provision/config/bashrc
2025-11-23 09:07:39 -08:00

82 lines
1.8 KiB
Bash

#!/usr/bin/env bash
# Bash configuration
export BASH_SILENCE_DEPRECATION_WARNING=1
# XDG Base Directory
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
# Homebrew (macOS)
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ -f "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -f "/usr/local/bin/brew" ]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
fi
# Go
if [ -d "/usr/local/go" ]; then
export PATH="$PATH:/usr/local/go/bin"
export PATH="$PATH:$HOME/go/bin"
fi
# Plan 9
if [ -d "/usr/local/plan9" ]; then
export PLAN9="/usr/local/plan9"
export PATH="$PATH:$PLAN9/bin"
fi
# History settings
export HISTSIZE=10000
export HISTFILESIZE=20000
export HISTCONTROL=ignoredups:erasedups
shopt -s histappend
# Aliases
alias ll='ls -lah'
alias la='ls -A'
alias l='ls -CF'
# Modern replacements
if command -v eza &> /dev/null; then
alias ls='eza'
alias ll='eza -la'
alias lt='eza --tree'
fi
if command -v bat &> /dev/null; then
alias cat='bat'
fi
# fd for Debian (named fd-find)
if command -v fdfind &> /dev/null && ! command -v fd &> /dev/null; then
alias fd='fdfind'
fi
# Git completions
if [ -f /usr/share/bash-completion/completions/git ]; then
. /usr/share/bash-completion/completions/git
fi
# Starship prompt
if command -v starship &> /dev/null; then
eval "$(starship init bash)"
fi
# Zoxide (smarter cd)
if command -v zoxide &> /dev/null; then
eval "$(zoxide init bash)"
fi
# fzf
if command -v fzf &> /dev/null; then
if [ -f ~/.fzf.bash ]; then
source ~/.fzf.bash
elif [ -f /usr/share/doc/fzf/examples/key-bindings.bash ]; then
source /usr/share/doc/fzf/examples/key-bindings.bash
fi
fi