GetStream / vg

Virtualgo: Easy and powerful workspace based development for go
MIT License
1.32k stars 45 forks source link

vg environment name does not display in the zsh #36

Closed hadisinaee closed 6 years ago

hadisinaee commented 6 years ago

Hi,

I'm using POWERLEVEL9K theme on zsh. When I activate a virtual environment, the theme doesn't change to show the name of the current environment. I sometimes forgot to deactivate it. How to set up zsh for showing the name of activated environment?

thanks

P.S: I'm using OSX and my zsh is the latest version.

JelteF commented 6 years ago

I think your theme overrides the default prompt changes that vg does. Luckily, it's quite easy to do the same yourself. vg sets the $VIRTUALGO shell variable to the name of the current environment. So if you can modify your theme to use that inside the prompt and see the current environment. (the simplest way to try it out is echo $VIRTUALGO)

JelteF commented 6 years ago

Closing this as I think this is clear now. Feel free to reopen if you still have issues.

hadisinaee commented 6 years ago

I fixed it. Thank you for $VIRTUALGO variable. I add the following to my .zshrc:

zsh_vg_env_name(){
    local color='%F{yellow}'
    if [ ! -z "$VIRTUALGO" ]; then
        echo -n "%{$color%}$VIRTUALGO"
    fi
}

POWERLEVEL9K_CUSTOM_VG_ENV_NAME="zsh_vg_env_name"
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status custom_vg_env_name root_indicator background_jobs history time)