2023-10-06 00:14:23 -04:00
|
|
|
# PS1
|
|
|
|
USER_COLOR="\[\033[01;32m\]"
|
|
|
|
HOST_COLOR="\[\033[01;38;5;183m\]"
|
|
|
|
WHITE="\[\033[00m\]"
|
|
|
|
PURPLE="\[\033[01;34m\]"
|
|
|
|
RED="\[\033[38;5;124m\]"
|
|
|
|
FAILED="$RED⛔$WHITE"
|
|
|
|
|
|
|
|
set_prompt() {
|
|
|
|
BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null)
|
|
|
|
if [ -n "$BRANCH" ]; then
|
|
|
|
BRANCH="$RED($WHITE$BRANCH$RED)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" == 0 ]; then
|
|
|
|
STATUS=""
|
|
|
|
else
|
|
|
|
STATUS="$FAILED"
|
|
|
|
fi
|
|
|
|
|
2023-10-06 01:45:15 -04:00
|
|
|
LEVEL=""
|
|
|
|
if [ $SHLVL -gt 1 ]; then
|
|
|
|
LEVEL="shellDepth=\$((SHLVL-1))"
|
|
|
|
fi
|
|
|
|
|
|
|
|
PS1="╭╴$USER_COLOR\u$HOST_COLOR@\h$BRANCH$WHITE:$PURPLE\w$WHITE $LEVEL $STATUS\n╰╴$ "
|
2023-10-06 00:14:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
PROMPT_COMMAND="set_prompt \$?; history -a"
|
|
|
|
|
|
|
|
|
|
|
|
#PATH manipulations
|
|
|
|
[[ -d ~/.local/bin ]] && PATH+=":$HOME/.local/bin"
|
|
|
|
|
|
|
|
# source: https://stackoverflow.com/a/44232192
|
|
|
|
PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')"
|
|
|
|
|
|
|
|
|
|
|
|
# Pokemon Sprite
|
|
|
|
[ -x "$(command -v pokemon-colorscripts)" ] &&
|
|
|
|
[ "$POKE" == "true" ] &&
|
|
|
|
pokemon-colorscripts -r 1-5
|