summaryrefslogtreecommitdiffstats
path: root/bashrc
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-01-10 01:32:46 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2012-01-10 01:32:46 +0100
commit9ee24479c2b6a21e4cdfebd77d0f2e0560682692 (patch)
tree21a2d61a604a94979a8972170587b1c0e9abb870 /bashrc
parent376cc082e5866538886aa7efc03a1fcfe13672fd (diff)
downloaddotfiles-9ee24479c2b6a21e4cdfebd77d0f2e0560682692.tar.gz
dotfiles-9ee24479c2b6a21e4cdfebd77d0f2e0560682692.tar.xz
dotfiles-9ee24479c2b6a21e4cdfebd77d0f2e0560682692.zip
common/prompt: display if currently using a python virtual env
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc/common/prompt.sh7
1 files changed, 5 insertions, 2 deletions
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)