# Managed by Ansible: HomeLab unified bash config.

export EDITOR="${EDITOR:-vim}"
export PAGER="${PAGER:-less}"
export LESS="${LESS:--FRSX}"
export HISTCONTROL="ignoreboth:erasedups"
export HISTSIZE=50000
export HISTFILESIZE=100000
shopt -s histappend 2>/dev/null || true
shopt -s checkwinsize 2>/dev/null || true

case ":$PATH:" in
  *":$HOME/.local/bin:"*) ;;
  *) export PATH="$HOME/.local/bin:$PATH" ;;
esac

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias grep='grep --color=auto'
alias ip='ip --color=auto'
alias df='df -h'
alias du='du -h'
alias free='free -h'
alias ..='cd ..'
alias ...='cd ../..'
alias please='sudo $(history -p !!)'

alias gs='git status --short --branch'
alias gd='git diff'
alias gl='git log --oneline --decorate -10'

if command -v systemctl >/dev/null 2>&1; then
  alias sctl='systemctl'
  alias jctl='journalctl'
fi

if [ -n "$PS1" ]; then
  if [ "$(id -u)" -eq 0 ]; then
    PS1='\[\e[31m\]\u@\h\[\e[0m\]:\[\e[34m\]\w\[\e[0m\]# '
  else
    PS1='\[\e[32m\]\u@\h\[\e[0m\]:\[\e[34m\]\w\[\e[0m\]\$ '
  fi
fi
