X-Git-Url: https://git.alrj.org/?p=zsh.d.git;a=blobdiff_plain;f=S90_prompt;h=8017507d5331239836200f2b2fac3a29e94bced1;hp=b9a7d4e9bb85d349e2fe92aee747a2e873bd66bb;hb=d564b8e0f70cd3cbc88733e2921f0a77a129a1f5;hpb=24e74f7cd9e63583edcc3facf253bf439202319f diff --git a/S90_prompt b/S90_prompt index b9a7d4e..8017507 100644 --- a/S90_prompt +++ b/S90_prompt @@ -6,7 +6,8 @@ # # Hide exit code after a blank line. # Inspired from https://github.com/robbyrussell/oh-my-zsh/blob/66b7fe1b27637feba61a4b47e113b18b69432bf2/themes/dieter.zsh-theme - +# The difference is that $get_exitcode is set to a command name which should be +# called. There's a layer of indirection. get_exitcode=true @@ -31,7 +32,7 @@ setprompt() _machine="${C_BRED}%m${C_NO}" # Git status in the pwd, if applicable - if [[ -n $__ZSH_GIT_BASEDIR ]]; then + if [[ -n ${__ZSH_GIT_BASEDIR} ]]; then _basedir="${C_GREEN}%20<..<${__ZSH_GIT_BASEDIR}%<<${C_NO}" _branch="${C_MAGENTA}@${__ZSH_GIT_BRANCH}${__ZSH_GIT_ACTION}${C_NO}" _status="${__ZSH_GIT_STATUS}" @@ -41,8 +42,14 @@ setprompt() _path="${C_GREEN}%25<..<%~%<<${C_NO}" fi + # Virtualenv activated ? + if [[ -n ${__ZSH_VIRTUAL_ENV_NAME} ]]; then + _venvname="${C_BCYAN}(${__ZSH_VIRTUAL_ENV_NAME})${C_NO}" + else + _venvname="" + fi - echo ${_username}@${_machine}:${_path} + echo ${_venvname}${_username}@${_machine}:${_path} }