156 lines · 3.8 KB
#!/usr/bin/env bash
shopt -s globstar
shopt -s histappend

export HISTCONTROL=ignorespace:ignoredups:erasedups
export HISTSIZE=1000
export HISTIGNORE="ls:cd:pwd:clear:exit:history:exit:shutdown:reboot"
export PROMPT_DIRTRIM=2

export CLICOLOR=1

# Where our dotfiles repo lives
export DOTFILES="$HOME/.dotfiles"

os="$(which_os)"

# OS/Distro specific stuff
case "$os" in
nixos)
    alias ls='ls --color=auto'
    alias zzz="sudo systemctl suspend"
    ;;

debian)
    # shellcheck disable=1091
    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
    ;;

darwin)
    eval "$(/opt/homebrew/bin/brew shellenv)"

    # Make sure XDG_CONFIG_HOME is a thing
    if [[ -z $XDG_CONFIG_HOME ]]; then
        export XDG_CONFIG_HOME="$HOME/.config"