Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Rewrite bash_profile

  • Loading branch information...
commit 5497dcc15ee3d7672c5cac92b189035da648a9fb 1 parent b5652f1
Christoph Heer authored

Showing 1 changed file with 57 additions and 22 deletions. Show diff stats Hide diff stats

  1. 79  bash/bash_profile
79  bash/bash_profile
... ...
@@ -1,32 +1,67 @@
1  
-export COLOR_DEFAULT=$'\e[37;40m'
2  
-export COLOR_PINK=$'\e[35;40m'
3  
-export COLOR_GREEN=$'\e[32;40m'
4  
-export COLOR_ORANGE=$'\e[33;40m'
  1
+# If not running interactively, don't do anything
  2
+[ -z "$PS1" ] && return
5 3
 
6  
-christoph_virtualenv() {
  4
+MY_DEFAULT_COLOR="[00m"
  5
+MY_GRAY_COLOR="[37m"
  6
+MY_PINK_COLOR="[35m"
  7
+MY_GREEN_COLOR="[32m"
  8
+MY_ORANGE_COLOR="[33m"
  9
+MY_RED_COLOR="[31m"
  10
+MY_BLUE_COLOR="[34m"
  11
+
  12
+MY_VC_PROMPT=$' on \033[34m%n\033[00m:\033[00m%b(\033[32m%m\033[31m%u\033[00m)'
  13
+
  14
+my_vcprompt() {
  15
+  vcprompt -f "${MY_VC_PROMPT}"
  16
+}
  17
+
  18
+my_virtualenv() {
7 19
   if [ x$VIRTUAL_ENV != x ]; then
8  
-    echo -n "|workon \[\033[31m\]"
9  
-    echo -n `basename "${VIRTUAL_ENV}"`
10  
-	echo -n "\[\e[37;40m\]"
  20
+    if [[ $VIRTUAL_ENV == *.virtualenvs/* ]]; then
  21
+      ENV_NAME=`basename "${VIRTUAL_ENV}"`
  22
+    else
  23
+      folder=`dirname "${VIRTUAL_ENV}"`
  24
+      ENV_NAME=`basename "$folder"`
  25
+    fi
  26
+    echo -n $' \033[37mworkon \033[36m'
  27
+    echo -n $ENV_NAME
  28
+    echo -n $'\033[00m'
11 29
   fi
12 30
 }
13 31
 
14  
-export CHRISTOPH_BASEPROMPT="\[${COLOR_PINK}\]\u\[${COLOR_DEFAULT}\]@\[${COLOR_ORANGE}\]\h\[${COLOR_DEFAULT}\]:\[${COLOR_GREEN}\]\w\[${COLOR_DEFAULT}\]`christoph_virtualenv`$ "
15  
-export PS1=$CHRISTOPH_BASEPROMPT
  32
+export MY_BASEPROMPT='\n\e${MY_PINK_COLOR}\u \
  33
+\e${MY_GRAY_COLOR}at \e${MY_ORANGE_COLOR}\h \
  34
+\e${MY_GRAY_COLOR}in \e${MY_GREEN_COLOR}\w\
  35
+\e${MY_GRAY_COLOR}`my_vcprompt`\
  36
+`my_virtualenv`\
  37
+\e${MY_DEFAULT_COLOR}'
  38
+export PS1="${MY_BASEPROMPT}
  39
+$ "
16 40
 
17  
-export NODE_PATH="/usr/local/lib/node:/usr/local/lib/node_modules"
  41
+export TERM=xterm-color
  42
+export CLICOLOR=1
  43
+if [ `uname` == "Darwin" ]; then
  44
+  export LSCOLORS=ExGxFxDxCxHxHxCbCeEbEb
  45
+  export LC_CTYPE=en_US.utf-8
  46
+  export LC_ALL=en_US.utf-8
  47
+else
  48
+  alias ls='ls --color=auto'
  49
+fi
18 50
 
19  
-export WORKON_HOME=$HOME/.virtualenvs
20  
-source /usr/local/bin/virtualenvwrapper.sh
21  
-export PIP_VIRTUALENV_BASE=$WORKON_HOME
22  
-export VIRTUAL_ENV_DISABLE_PROMPT=1
23  
-
24  
-alias py='python'
25 51
 alias ls='ls -Gh'
26 52
 alias mkvirtualenv='mkvirtualenv --no-site-packages'
27  
-alias edit='choc'
28  
-alias mate='choc'
29 53
 
30  
-if [ x`which hub` != x ]; then
31  
-  alias git=hub
32  
-fi
  54
+export IGNOREEOF=1
  55
+export PYTHONDONTWRITEBYTECODE=1
  56
+
  57
+# virtualenvwrapper and pip
  58
+if [ `id -u` != '0' ]; then
  59
+  export VIRTUALENV_USE_DISTRIBUTE=1
  60
+  if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
  61
+    export WORKON_HOME=$HOME/.virtualenvs
  62
+    source /usr/local/bin/virtualenvwrapper.sh
  63
+  fi
  64
+fi
  65
+
  66
+# don't let virtualenv show prompts by itself
  67
+VIRTUAL_ENV_DISABLE_PROMPT=1

0 notes on commit 5497dcc

Please sign in to comment.
Something went wrong with that request. Please try again.