Merge branch 'vadviktor-vadviktor-patch-pyenv'

* vadviktor-vadviktor-patch-pyenv:
  Merge remote-tracking branch 'origin/master' into vadviktor-patch-pyenv
  Adding Pyenv support to Python virtualenv as "fallback"
This commit is contained in:
Caio Gondim
2015-10-12 23:57:16 +02:00
2 changed files with 14 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ theme based on the
simplicity, showing information only when it's relevant. simplicity, showing information only when it's relevant.
It currently shows: It currently shows:
- Current Python virtualenv - Current Python virtualenv; when using Pyenv and no active virtualenv shows the current Python version the shell uses
- Current Ruby version using Rbenv or chruby; version and gemset when on RVM - Current Ruby version using Rbenv or chruby; version and gemset when on RVM
- Current Node.js version, through NVM - Current Node.js version, through NVM
- Git status - Git status
@@ -137,7 +137,7 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|`BULLETTRAIN_CONTEXT_DEFAULT_USER`|none|Default user. If you are running with other user other than default, the segment will be showed. |`BULLETTRAIN_CONTEXT_DEFAULT_USER`|none|Default user. If you are running with other user other than default, the segment will be showed.
|`BULLETTRAIN_IS_SSH_CLIENT`|none|If `true`, the segment will be showed. |`BULLETTRAIN_IS_SSH_CLIENT`|none|If `true`, the segment will be showed.
### Python virtualenv ### Python virtualenv (+Pyenv)
|Variable|Default|Meaning |Variable|Default|Meaning
|--------|-------|-------| |--------|-------|-------|

View File

@@ -395,6 +395,8 @@ prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV" local virtualenv_path="$VIRTUAL_ENV"
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(basename $virtualenv_path)" prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(basename $virtualenv_path)"
elif which pyenv &> /dev/null; then
prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(pyenv version | sed -e 's/ (set.*$//')"
fi fi
} }
@@ -496,4 +498,10 @@ build_prompt() {
prompt_end prompt_end
} }
PROMPT='$(prompt_line_sep)%{%f%b%k%}$(build_prompt)$(prompt_line_sep)%{${fg_bold[default]}%}$(prompt_char) %{$reset_color%}' if [[ $BULLETTRAIN_PROMPT_SEPARATE_LINE == true ]] then
PROMPT='
%{%f%b%k%}$(build_prompt)
%{${fg_bold[default]}%}$(prompt_char) %{$reset_color%}'
else
PROMPT='%{%f%b%k%}$(build_prompt)%{${fg_bold[default]}%} $(prompt_char) %{$reset_color%}'
fi