mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Added the virtualenv_prompt_info function.
This commit is contained in:
parent
d05b2010ff
commit
1347cb7bb0
1 changed files with 17 additions and 0 deletions
17
plugins/virtualenv/virtualenv.plugin.zsh
Normal file
17
plugins/virtualenv/virtualenv.plugin.zsh
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
|
|
||||||
|
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="("
|
||||||
|
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX=")"
|
||||||
|
|
||||||
|
function virtualenv_prompt_info() {
|
||||||
|
if [ -n "$VIRTUAL_ENV" ]; then
|
||||||
|
if [ -f "$VIRTUAL_ENV/__name__" ]; then
|
||||||
|
local name=`cat $VIRTUAL_ENV/__name__`
|
||||||
|
elif [ `basename $VIRTUAL_ENV` = "__" ]; then
|
||||||
|
local name=$(basename $(dirname $VIRTUAL_ENV))
|
||||||
|
else
|
||||||
|
local name=$(basename $VIRTUAL_ENV)
|
||||||
|
fi
|
||||||
|
echo "$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX$name$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX"
|
||||||
|
fi
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue