[ -z "$PS1" ] && return

HISTCONTROL=ignoreboth

shopt -s histappend

HISTSIZE=1000
HISTFILESIZE=2000

shopt -s checkwinsize

if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  color_prompt=yes
    else
  color_prompt=
    fi
fi

if [ -f ~/.bashcolors ]; then
    . ~/.bashcolors
else
    colorTime="\[\033[38;5;39m\]"
    colorUser="\[\033[38;5;202m\]"
    colorAt="\[\033[38;5;196m\]"
    colorHost="\[\033[38;5;88m\]"
    colorWorkDir="\[\033[38;5;131m\]"
    colorPrompt="\[\033[38;5;203m\]"
    colorFlair="\[\033[38;5;206m\]"
fi

white="\[\033[00m\]"
clock=$white$colorTime"\A"$white"] "
user=$colorUser"\u"
at=$colorAt"🍉"
host=$colorHost"\h"
workDir=" "$colorWorkDir"\\w"
prompt=$colorPrompt"\\$ "$white
flairTopLeft=$colorFlair"╭─("
flairBottom="$colorFlair╰("

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}'$flairTopLeft$user$at$host$colorFlair")"$workDir'\n'$flairBottom$prompt
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto -X --group-directories-first'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi
export PATH="$HOME/.local/bin:/opt/emacs/bin:$PATH"
