Skip to content

Commit

Permalink
Virtual env zsh support + beauty
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Jun 15, 2011
1 parent 4126b0e commit b0ef6a1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
9 changes: 5 additions & 4 deletions .zsh.d/1_env
Expand Up @@ -11,13 +11,14 @@ export EDITOR="emacsclient -c"
export BROWSER=chromium-browser
export GPGKEY=1193ADBC
export WORDCHARS="_-"
# Host specific configuration
export WORKON_HOME=~/.envs
source /usr/bin/virtualenvwrapper.sh

# Host specific configuration
case $HOST in
archwork)
archwork)
export http_proxy=http://10.20.68.3:8080
export https_proxy=http://10.20.68.3:8080
export ftp_proxy=http://10.20.68.3:8080
;;
esac


27 changes: 21 additions & 6 deletions .zsh.d/3_prompt
Expand Up @@ -19,12 +19,12 @@ done
local bar="${__white}"

# Are we root ?
if [ "`id -u`" -eq 0 ];
if [ "`id -u`" -eq 0 ];
then
bar="${__red}"
else
case $HOST in
archwork)
arkozea)
bar="${__magenta}"
;;
archleeenux)
Expand All @@ -33,11 +33,16 @@ else
ark)
bar="${__green}"
;;
fanny|julia|cecile)
bar="${__yellow}"
;;
esac
fi

bar="%(?,${bar},${__yellow})"

local top="${bar}┌─"
local bottom="${bar}"
local bottom="${bar}"
# if we are in a subshell add a '-' for each sub level to the bottom
if [ $SHLVL -gt 1 ];
then
Expand All @@ -46,7 +51,6 @@ then
bottom="${bottom}"
done
fi
bottom="${bottom}> "
local sep="${bar}"
local time="${__white}[${bar}%*${__white}]"
local user="${__blue}%n"
Expand All @@ -63,12 +67,23 @@ local num="${__white}(${bar}%h${__white})"
local dir='${bar}${${(%):-%~}//\//${__white}/${__red}}'
local vcinfo='$(X_prompt_vc_info)'

function active_virtualenv() {
if [ -z "$VIRTUAL_ENV" ]; then
return
fi
echo "${__yellow}{ `basename \"$VIRTUAL_ENV\"` }${sep}"
}

local _env='$(active_virtualenv)'

bottom="${bottom}${_env}"

local prmpt="
${top}${time}${sep}${user}${at}${host}${term}${colon}${dir}${__white}/
${top}${time}${sep}${user}${at}${host}${colon}${dir}${__white}/
${bottom}${dollar}${___} "
local prmpt2="${bottom}${__blue}%_ ${__white}>${___} "

local rprmpt="${bar}<${__white}${vcinfo}${sep}${ret}${sep}${num}${sep} ${stat}${___}"
local rprmpt="${bar}${__white}${vcinfo}${sep}${ret}${sep}${num}${sep}${___}"

export PS1="${prmpt}"
export PS2="${prmpt2}"
Expand Down

0 comments on commit b0ef6a1

Please sign in to comment.