dotfiles/dot_bashrc

56 lines
1.2 KiB
Plaintext

# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# start in home directory
# shellcheck disable=SC2164
if [ "$PWD" != "$HOME" ] && [ "$PWD" -ef "$HOME" ] ; then cd ; fi
# change $HOME on FreeBSD to /usr/home/andrew
# shellcheck disable=SC2164
if [ -d "/usr$HOME" ] ; then export HOME=/usr$HOME ; cd ; fi
# load system bashrc
for BASHRC in /etc/bashrc /etc/bash.bashrc /etc/bash/bashrc ; do
if [ -f "$BASHRC" ] ; then
# shellcheck source=/dev/null
. "$BASHRC"
fi
done
unset BASHRC
# this assumes nvim is always installed for $EDITOR
EDITOR=nvim; export EDITOR
# local paths
if ! [[ "$PATH" =~ $HOME/.local/bin:$HOME/bin: ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
# shellcheck source=/dev/null
. "$rc"
fi
done
fi
unset rc
if [ -f "$HOME/.bash-preexec.sh" ] ; then
source "$HOME/.bash-preexec.sh"
eval "$("$HOME/.cargo/bin/atuin" init bash)"
fi
# direnv hook
if which direnv > /dev/null 2>&1 ; then
eval "$(direnv hook bash)"
fi
if which zoxide > /dev/null 2>&1 ; then
eval "$(zoxide init bash)"
# shellcheck disable=SC2139
alias z="$(which zoxide)"
fi