├── virtualenv-prompt.plugin.zsh └── README.md /virtualenv-prompt.plugin.zsh: -------------------------------------------------------------------------------- 1 | export VIRTUAL_ENV_DISABLE_PROMPT=1 2 | 3 | ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="(" 4 | ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX=")" 5 | 6 | function virtualenv_prompt_info() { 7 | if [ -n "$VIRTUAL_ENV" ]; then 8 | if [ -f "$VIRTUAL_ENV/__name__" ]; then 9 | local name=`cat $VIRTUAL_ENV/__name__` 10 | elif [ `basename $VIRTUAL_ENV` = "__" ]; then 11 | local name=$(basename $(dirname $VIRTUAL_ENV)) 12 | else 13 | local name=$(basename $VIRTUAL_ENV) 14 | fi 15 | echo "$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX$name$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX" 16 | fi 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | oh-my-zsh::plugin::virtualenv-prompt 2 | ==================================== 3 | 4 | This is a fork of the virtualenv plugin from upstream. It support to customize 5 | the virtualenv prompt in oh-my-zsh themes. 6 | 7 | Installation 8 | ------------ 9 | 10 | You can install this plugin via [antigen](https://github.com/zsh-users/antigen): 11 | 12 | # $HOME/.zshrc 13 | source /usr/local/share/antigen.zsh 14 | 15 | antigen use oh-my-zsh 16 | antigen bundle tonyseek/oh-my-zsh-virtualenv-prompt 17 | antigen theme tonyseek/oh-my-zsh-seeker-theme seeker # optional 18 | antigen apply 19 | 20 | It could be upgraded by `antigen update` command. 21 | 22 | Customize Theme 23 | --------------- 24 | 25 | There are two constant strings which could be overrided in your custom theme. 26 | 27 | - `ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX` 28 | - `ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX` 29 | 30 | And the function `virtualenv_prompt_info` could be used in the prompt of your 31 | theme. 32 | 33 | Example 34 | ------- 35 | 36 | See the [oh-my-zsh::theme::seeker](https://github.com/tonyseek/oh-my-zsh-seeker-theme). 37 | --------------------------------------------------------------------------------