From 9ee24479c2b6a21e4cdfebd77d0f2e0560682692 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 10 Jan 2012 01:32:46 +0100 Subject: common/prompt: display if currently using a python virtual env --- bashrc/common/prompt.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bashrc/common') diff --git a/bashrc/common/prompt.sh b/bashrc/common/prompt.sh index f7db66e..d1efebe 100644 --- a/bashrc/common/prompt.sh +++ b/bashrc/common/prompt.sh @@ -7,7 +7,7 @@ export PS2="$(pcolor lblue)> $(pcolor)" export PS3="$(color lblue)#? $(color)" __make_prompt() { - local PS1UH PS1D PS1R PS1F PS1P PS1BO PS1BC user host rc=$? s + local PS1UH PS1D PS1R PS1F PS1P PS1BO PS1BC PS1VE user host rc=$? s # username + nodename if [[ $(id -u) -eq 0 ]]; then @@ -33,6 +33,9 @@ __make_prompt() { # environment flags [[ "${TERM#screen}" != "${TERM}" ]] && PS1F="${PS1F}$(pcolor lcyan)s$(pcolor)" + # python virtual env + [[ -n "${VIRTUAL_ENV}" ]] && PS1VE="$(pcolor lred)<${VIRTUAL_ENV#${WORKON_HOME}/}>$(pcolor) " + # prompt character PS1P="$(pcolor lblue)\\\$ $(pcolor)" @@ -100,7 +103,7 @@ __make_prompt() { s="${s} " fi - export PS1="${PS1UH}${PS1D} ${PS1BO}${PS1R}${PS1F}${PS1BC} ${s}${PS1P}" + export PS1="${PS1VE}${PS1UH}${PS1D} ${PS1BO}${PS1R}${PS1F}${PS1BC} ${s}${PS1P}" if [[ "${TERM#screen}" != "${TERM}" ]]; then _hostname=$(hostname) -- cgit v1.2.3