# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
	for rc in ~/.bashrc.d/*; do
		if [ -f "$rc" ]; then
			. "$rc"
		fi
	done
fi

unset rc


# Pager
export PAGER=less

# Editor
EDITOR=/usr/bin/vim
export EDITOR

# Terminal colors
export TERM=xterm-color

# Custom bash prompt
BLUE='\033[0;34m'
RED='\e[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
LIGHT_BLUE='\033[0;36m'
CYAN='\e[1;36m'
PINK='\033[1;35m'
BOLD='\033[1m'
RESET='\033[0m'

PS1="${BLUE}┌[${GREEN}$(whoami)${BLUE}@${LIGHT_BLUE}$(hostname)${BLUE}]${RESET} - ${BLUE}[${RESET}${BOLD}\w${RESET}${BLUE}]${RESET} - ${BLUE}[${YELLOW}\!${BLUE}]${RESET} - [\D{%X}]\n${BLUE}└[${PINK}\$${BLUE}]${RESET} "

export PS1

shopt -s cdspell
shopt -s cdable_vars
shopt -s checkhash
shopt -s checkwinsize
shopt -s sourcepath
shopt -s no_empty_cmd_completion
shopt -s cmdhist
shopt -s histappend histreedit histverify

unset MAILCHECK

export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n'
export HISTTIMEFORMAT="%H:%M >  "
export HISTIGNORE="&:bg:fg:ll:h"
export HOSTFILE=$HOME/.hosts

source .bash-completions

echo -e "┌ ${CYAN}BASH ${RED}${BASH_VERSION%.*}\
${CYAN} - DISPLAY ${RED}$DISPLAY${RESET}\n│"
echo -e "│ Welcome home, ${USER}"
echo -e "└ $(date)"
function _exit() {
	echo -e "Bye!"
}
trap _exit EXIT

alias path='echo -e ${PATH//:/\\n}'
alias mkdir='mkdir -p'

alias h='history'
alias j='jobs -l'
alias which='type -a'
alias du='du -kh'
alias df='df -kTh'


# Find a file with a pattern in name:
function ff() { find . -type f -iname '*'$*'*' -ls ; }

export PATH=$PATH:$HOME/.local/bin

