.profile: Make the fancy PS1 bash-specific

Because holy good god damn that fucked up every other prompt fml
This commit is contained in:
Salt 2019-10-24 00:20:03 -05:00
parent 013c63357b
commit 148f8b1926

View File

@ -264,22 +264,21 @@ alias cp='cp -i'
alias d='du -hs'
alias todo='$EDITOR "$HOME/Documents/todo"'
# Set up a default PS1
# This *should* work for all terminals. I know it works on ksh
_ps1() {
# Set up a default PS1 for bash
_ps1bash() {
exitcode="$?"
r="\e[0m"
bg_red="\e[41m"
bg_yellow="\e[43m"
bg_blue="\e[44m"
fg_black="\e[30m"
fg_red="\e[31m"
fg_green="\e[32m"
fg_yellow="\e[33m"
fg_blue="\e[34m"
fg_magenta="\e[35m"
fg_grey="\e[37m"
fg_bold="\e[1m"
r="\[\e[0m\]"
bg_red="\[\e[41m\]"
bg_yellow="\[\e[43m\]"
bg_blue="\[\e[44m\]"
fg_black="\[\e[30m\]"
fg_red="\[\e[31m\]"
fg_green="\[\e[32m\]"
fg_yellow="\[\e[33m\]"
fg_blue="\[\e[34m\]"
fg_magenta="\[\e[35m\]"
fg_grey="\[\e[37m\]"
fg_bold="\[\e[1m\]"
# Add hostname prefix in SSH sessions
# Yes, shellcheck. I get it. That's what the or is for
@ -343,7 +342,7 @@ _ps1() {
fail="${fg_bold}${fg_red}?"
fi
# shellcheck disable=2059
printf "[${prefix}${cpwd}${r}]${fail}${r}${prompt}${r} "
PS1="[${prefix}${cpwd}${r}]${fail}${r}${prompt}${r} "
}
# And export our PS1
@ -352,8 +351,9 @@ case "$_baseshell" in
# Don't do this on ZSH
# I have a custom theme for that
;;
*bash|ksh)
export PS1='$(_ps1)'
*bash)
export PS1=""
export PROMPT_COMMAND=_ps1bash
;;
*)
export PS1='[\e[31m\w\e[0m]\e[32m\$\e[0m '