~tristan957/dotfiles

4807a710040d87e3d6caad29bc5284133e7e1ad1 — Tristan Partin a month ago 022469a
Add better support for Python venvs and future extra prompt info
1 files changed, 15 insertions(+), 3 deletions(-)

M bash/.bashrc
M bash/.bashrc => bash/.bashrc +15 -3
@@ 70,10 70,19 @@ GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_DESCRIBE_STYLE="auto"
GIT_PS1_HIDE_IF_PWD_IGNORED=1
GIT_PS1_STATESEPARATOR=" "
branch='$(__git_ps1 "[%s]")'
branch='$(__git_ps1 " \[$(tput setaf 39)\][%s]")'

# Prompt
PS1="$(tput bold)\[$(tput setaf 208)\][\$? \j \t] \[$(tput setaf 76)\][\u@\H] \[$(tput setaf 214)\][\W] \[$(tput setaf 39)\]${branch}\[$(tput sgr0)\]\n\[$(tput bold)\]\$ \[$(tput sgr0)\]"
function __prompt_extras() {
	PROMPT_EXTRAS=""
	# Python virtual environments are so fun
	if [[ -n ${VIRTUAL_ENV+x} ]]; then
		PROMPT_EXTRAS="${PROMPT_EXTRAS} $(tput setaf 105)[$(basename ${VIRTUAL_ENV})]"
	fi

	echo -ne $PROMPT_EXTRAS
}

PS1="$(tput bold)\[$(tput setaf 208)\][\$? \j \t] \[$(tput setaf 76)\][\u@\H] \[$(tput setaf 214)\][\W]${branch} \$(__prompt_extras)\[$(tput sgr0)\]\n\[$(tput bold)\]\$ \[$(tput sgr0)\]"
PS2="$(tput bold)> \[$(tput sgr0)\]"
PS3="$(tput bold)> \[$(tput sgr0)\]"
PS4="$(tput bold)> \[$(tput sgr0)\]"


@@ 100,6 109,9 @@ else
	export VISUAL="nano"
fi

# Python virtual environments should stop messing with PS1
export VIRTUAL_ENV_DISABLE_PROMPT=1

# Forget about "unable to sign commit" errors
export GPG_TTY=$(tty)