1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-06 21:45:10 +01:00

Fix for virtualenv info not showing anymore. Inspiration from

http://stackoverflow.com/questions/14987013/why-is-virtualenv-not-setting-my-terminal-prompt
This commit is contained in:
Michiel Scholten
2014-12-07 09:56:44 +01:00
parent bd5edaf255
commit de83ed39dd

18
.bashrc
View File

@@ -71,13 +71,13 @@ set_bash_prompt(){
PROMPT_SYMBOL='$'
if [ $USER = 'root' ]; then
#PS1="$YELLOW\t $RED\u$BLACK@\h:\W# "
PS1="$YELLOW\t $RED\u$BLACK@\h:\W$(jobscount)# "
PS1="$(venvinfo)$YELLOW\t $RED\u$BLACK@\h:\W$(jobscount)# "
elif [ -e ~/.dot_is_server ]; then
#PS1="$YELLOW\t $GREEN\u$BLACK@\h:\W$ "
PS1="$YELLOW\t $GREEN\u$BLACK@\h:\W$(jobscount)$ "
PS1="$(venvinfo)$YELLOW\t $GREEN\u$BLACK@\h:\W$(jobscount)$ "
else
#PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$ "
PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$(jobscount)$ "
PS1="$(venvinfo)$YELLOW\t $BLUE\u$BLACK@\h:\W$(jobscount)$ "
fi
#PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$(hg_ps1)$ "
#PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$(hg_ps1)$(__git_ps1)$ "
@@ -85,11 +85,23 @@ set_bash_prompt(){
}
jobscount() {
# Show amount of running and stopped (backgrounded) jobs
local stopped=$(jobs -sp | wc -l)
local running=$(jobs -rp | wc -l)
((running+stopped)) && echo -n "[${running}r/${stopped}s]"
}
venvinfo() {
# Virtualenv information
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
echo "[`basename \`dirname \"$VIRTUAL_ENV\"\``] "
elif [ "$VIRTUAL_ENV" != "" ]; then
echo "(`basename \"$VIRTUAL_ENV\"`) "
fi
}
# gitprompt configuration
# Set config variables first
#GIT_PROMPT_ONLY_IN_REPO=1