diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..fd4b61e --- /dev/null +++ b/.bashrc @@ -0,0 +1,73 @@ +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +function debug() { + if [[ -v "$DEBUG" ]]; then + echo "$1" + fi +} + +# Run systemd generators +if [[ -f /usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator ]]; then + set -o allexport + # shellcheck disable=1090 + source <(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator) + set +o allexport +fi + +# User specific environment +if ! [[ "$PATH" =~ $HOME/.local/bin:$HOME/bin: ]]; then + PATH="$HOME/.local/bin:$HOME/bin:$PATH" +fi + +# User specific aliases and functions +if [ -d ~/.bashrc.d ]; then + for rc in ~/.bashrc.d/*; do + if [ -f "$rc" ]; then + # shellcheck disable=1090 + . "$rc" + fi + done +fi +unset rc + +# Environment variables + +# history control +HISTSIZE=10000 +HISTFILESIZE=$HISTSIZE +HISTCONTROL=ignorespace:ignoredups +shopt -s histappend + +if command -v nvim > /dev/null; then + debug "✅ setting EDITOR to nvim" + export EDITOR=nvim + + debug "✅ setting MANPAGER viewer to nvim" + export MANPAGER="nvim +Man!" +else + debug "⚠️ nvim not found" +fi + +# Tools + +# fzf +if command -v fzf > /dev/null; then + eval "$(fzf "--$(basename "$SHELL")")" + debug "✅ set up fzf" +else + debug "⚠️ fzf not found" +fi + +# starship +if command -v starship > /dev/null; then + eval "$(starship init "$(basename "$SHELL")")" + debug "✅ set up starship" +else + debug "⚠️ starship not found" +fi + +# Aliases +alias nview="nvim -R" diff --git a/.profile b/.profile index 084981b..fa2f9e4 100644 --- a/.profile +++ b/.profile @@ -2,6 +2,7 @@ if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" + # shellcheck disable=SC1090 + . "$HOME/.bashrc" fi fi