99 lines
2.6 KiB
Bash
99 lines
2.6 KiB
Bash
# ~/.bashrc: executed by bash(1) for non-login shells.
|
|
|
|
# If not running interactively, don't do anything
|
|
case $- in
|
|
*i*) ;;
|
|
*) return;;
|
|
esac
|
|
|
|
# History configuration
|
|
HISTCONTROL=erasedups:ignoredups:ignorespace
|
|
HISTSIZE=1000
|
|
HISTFILESIZE=2000
|
|
export HISTTIMEFORMAT="%F %T"
|
|
PROMPT_COMMAND='history -a'
|
|
shopt -s histappend
|
|
|
|
# Shell options
|
|
shopt -s checkwinsize
|
|
# Uncomment to enable globstar (bash 4.0+)
|
|
# shopt -s globstar
|
|
|
|
# XDG Base Directory Specification
|
|
export XDG_DATA_HOME="$HOME/.local/share"
|
|
export XDG_CONFIG_HOME="$HOME/.config"
|
|
export XDG_STATE_HOME="$HOME/.local/state"
|
|
export XDG_CACHE_HOME="$HOME/.cache"
|
|
|
|
export EDITOR=nano
|
|
export VISUAL=codium
|
|
|
|
# Chroot detection for prompt
|
|
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
|
debian_chroot=$(cat /etc/debian_chroot)
|
|
fi
|
|
|
|
if [ "$TERM" = "xterm-kitty" ]; then
|
|
export TERM=xterm-256color
|
|
fi
|
|
|
|
# Colored prompt configuration
|
|
case "$TERM" in
|
|
xterm-color|*-256color) color_prompt=yes;;
|
|
esac
|
|
|
|
# Set prompt
|
|
if [ "$color_prompt" = yes ]; then
|
|
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
|
else
|
|
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
|
fi
|
|
unset color_prompt
|
|
|
|
# Set terminal title for xterm-compatible terminals
|
|
case "$TERM" in
|
|
xterm*|rxvt*)
|
|
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
|
;;
|
|
esac
|
|
|
|
# Enable color support for ls and grep
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
# Basic ls color alias (will be overridden by eza if available)
|
|
alias ls='ls --color=auto'
|
|
alias grep='grep --color=auto'
|
|
alias fgrep='fgrep --color=auto'
|
|
alias egrep='egrep --color=auto'
|
|
fi
|
|
|
|
# Load custom aliases
|
|
[ -f ~/.bash_aliases ] && . ~/.bash_aliases
|
|
|
|
# Enable bash completion
|
|
if ! shopt -oq posix; then
|
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
. /usr/share/bash-completion/bash_completion
|
|
elif [ -f /etc/bash_completion ]; then
|
|
. /etc/bash_completion
|
|
fi
|
|
fi
|
|
|
|
# Add sbin to $PATH
|
|
export PATH=$PATH:/sbin
|
|
|
|
# Exercism completion
|
|
[ -f ~/.config/exercism/exercism_completion.bash ] && . ~/.config/exercism/exercism_completion.bash
|
|
|
|
# Show welcome info only for interactive login shells
|
|
if shopt -q login_shell && [ -t 0 ]; then
|
|
# Check if commands exist before running
|
|
command -v fastfetch >/dev/null 2>&1 && fastfetch
|
|
command -v fortune >/dev/null 2>&1 && command -v cowsay >/dev/null 2>&1 && fortune | cowsay
|
|
fi
|
|
|
|
[ -f ~/.bash_functions ] && . ~/.bash_functions
|
|
|
|
eval "$(starship init bash)"
|
|
|