diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-04-16 11:19:39 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-04-16 11:22:15 +0200 |
commit | f6d1867142635e9df7b2f6fd7df4ff4cfbc4c727 (patch) | |
tree | 7d86b1278bf6604eb7f98290145cf45225fa8286 | |
parent | 3ec21e09db49713fcdfa61815ab15d9a75a8591c (diff) | |
download | dotfiles-f6d1867142635e9df7b2f6fd7df4ff4cfbc4c727.tar.xz |
zsh/prompt: Add virtual env to prompt
-rw-r--r-- | zsh/prompt.zsh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index f629be0..67e17b4 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -24,25 +24,30 @@ bg[blue]='%K{21}' fg[light_blue]='%F{blue}' fg[blue]='%F{21}' +function virtualenv_prompt { + if [[ -n "$VIRTUAL_ENV" ]]; then + print "$bg[light_blue]$fg[white] $(basename $VIRTUAL_ENV) %f%k" + fi +} if (( UID == 0 )); then - PROMPT='$bg[light_red] $fg[white]%m%f %k$bg[white]$fg[light_red] %~ %f%k + PROMPT='$bg[light_red] $fg[white]%m%f %k$bg[white]$fg[light_red] %~ %f%k$(virtualenv_prompt) $bg[light_blue]%B ^_^ %b%k ' else case $SHORTHOST in "theos") - PROMPT='$bg[light_pink] $fg[white]%m%f %k$bg[white]$fg[light_pink] %~ %f%k + PROMPT='$bg[light_pink] $fg[white]%m%f %k$bg[white]$fg[light_pink] %~ %f%k$(virtualenv_prompt) $bg[light_blue]%B ^_^ %b %k' ;; "lucifer") - PROMPT='$bg[dark_gold] $fg[white]%m%f %k$bg[white]$fg[dark_gold] %~ %f%k + PROMPT='$bg[dark_gold] $fg[white]%m%f %k$bg[white]$fg[dark_gold] %~ %f%k$(virtualenv_prompt) $bg[light_blue]%B ^_^ %b %k' ;; *) - PROMPT='$bg[black] $fg[white]%m%f %k$bg[white]$fg[black] %~ %f%k + PROMPT='$bg[black] $fg[white]%m%f %k$bg[white]$fg[black] %~ %f%k$(virtualenv_prompt) $bg[light_blue]%B ^_^ %b %k' ;; |