Files
dotfiles/dot_bashrc
2026-02-18 15:50:37 +00:00

137 lines
3.3 KiB
Plaintext

[[ $- != *i* ]] && return
shopt -s histappend
shopt -s checkwinsize
export HISTCONTROL=ignoreboth
export HISTSIZE=1000
export HISTFILESIZE=2000
set -o vi
export EDITOR=nvim
export GIT_EDITOR=nvim
export PIPENV_VERBOSITY=-1
export MAKEFLAGS="-j$(($(nproc) + 1))"
export JULIA_NUM_THREADS="$(nproc)"
export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35"
export XDG_CONFIG_HOME="$HOME/.config"
export PASSWORD_STORE_DIR="$HOME/.cache/password-store"
export GLAMOUR_STYLE="$XDG_CONFIG_HOME/glamour/tokyo_night.json"
if [[ "$(uname)" != "Windows_NT" ]]; then
export GPG_TTY=$(tty)
fi
export LESS_TERMCAP_mb=$'\e[01;31m'
export LESS_TERMCAP_md=$'\e[01;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;44;36m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_us=$'\e[00;36m'
export LESS_TERMCAP_ue=$'\e[0m'
if [ -f "$HOME/.config/path.env" ]; then
while IFS= read -r line || [[ -n "$line" ]]; do
[[ "$line" =~ ^#.*$ || -z "$line" ]] && continue
expanded_path="${line/#\~/$HOME}"
if [ -d "$expanded_path" ]; then
export PATH="$expanded_path:$PATH"
fi
done < "$HOME/.config/path.env"
fi
# --- Aliases ---
# Modern Unix Replacements
alias cat='bat'
alias du='dust'
alias df='duf'
alias grep='rg'
alias cp='xcp'
alias find='fd'
alias top='btm'
alias htop='btm'
alias burn='command rm'
alias rm='rip'
# Convenience aliases
alias free='free -m'
alias npkg='nano -w PKGBUILD'
alias q='exit'
alias :q='exit'
alias c='clear'
alias h='history'
alias lsa='ls -a'
alias lsl='ls -l'
alias lsla='ls -la'
# Navigation
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# Python / Poetry
alias pip-upgrade='python -m pip install --upgrade pip'
alias pypy='pypy3'
alias poem='poetry run python'
alias bashpoem='poetry run bash'
alias nupoem='poetry run nu'
alias jupyterpoem='poetry run jupyter'
# Misc
alias vim='nvim'
alias vi='nvim'
alias nix-bash='nix-shell --command bash'
cd() {
builtin cd "$@" || return
if [ -d .git ] && command -v onefetch >/dev/null 2>&1; then
onefetch --nerd-fonts
fi
}
sysfetch() {
if command -v fastfetch >/dev/null 2>&1; then
if { [[ "$TERM" == *"kitty"* ]] || [[ "$TERM" == *"ghostty"* ]]; } \
&& [ -f "$HOME/.config/fastfetch/kitty.jsonc" ]; then
fastfetch --config "$HOME/.config/fastfetch/kitty.jsonc"
else
fastfetch
fi
elif command -v neofetch >/dev/null 2>&1; then
echo "Why are you still using neofetch? It's deprecated!"
neofetch
elif command -v screenfetch >/dev/null 2>&1; then
screenfetch
elif command -v archey >/dev/null 2>&1; then
archey
elif command -v lsb_release >/dev/null 2>&1; then
lsb_release -a
elif command -v uname >/dev/null 2>&1; then
uname
fi
}
# --- Plugin Initializations ---
# Starship
if command -v starship >/dev/null 2>&1; then
eval "$(starship init bash)"
fi
# Atuin (Shell History)
if command -v atuin >/dev/null 2>&1; then
eval "$(atuin init bash)"
fi
# Direnv
if command -v direnv >/dev/null 2>&1; then
eval "$(direnv hook bash)"
fi
# Rbw (Bitwarden)
if command -v rbw >/dev/null 2>&1; then
eval "$(rbw gen-completions bash)"
fi
sysfetch