From a0e3217fea8e3043df733451da1d4ba3e0d231f6 Mon Sep 17 00:00:00 2001 From: Victor Ferraz Date: Sun, 22 Apr 2018 12:07:45 -0300 Subject: [PATCH] [master] Add better pipenv support --- guri.zsh-theme | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/guri.zsh-theme b/guri.zsh-theme index 99e1d48..5b1e22d 100644 --- a/guri.zsh-theme +++ b/guri.zsh-theme @@ -79,9 +79,9 @@ git_prompt_info() { printf "$ZSH_THEME_GIT_PROMPT_SUFFIX$git_status$reset_color" } -dockerm_prompt_info() { - if [[ -n "$DOCKER_MACHINE_NAME" ]]; then - echo "$fg[green] $GURI_DOCKER_ICON$DOCKER_MACHINE_NAME" +zenv_prompt_info() { + if [[ -n "$Z_ENV_NAME" ]]; then + echo "$fg[green] $Z_UNICODE_SYMBOL" fi } @@ -115,15 +115,21 @@ run_dot_file() { } virtualenv_indicator() { - if [[ -n "$VIRTUAL_ENV" ]]; then - psvar[1]="${VIRTUAL_ENV##*/} " - psvar[2]=" v$(python --version 2>&1 | sed -e "s/Python //")" + if [[ -n "$Z_ENV_NAME" ]]; then + psvar[1]="${Z_ENV_NAME} " + elif [[ -n "$VIRTUAL_ENV" ]]; then + if [[ "$PIPENV_ACTIVE" -eq 1 ]]; then + psvar[1]="venv " + else + psvar[1]="${VIRTUAL_ENV##*/} " + fi else psvar[1]="" - psvar[2]="" fi + psvar[2]=" v$(python --version 2>&1 | sed -e "s/Python //")" } + exec_time_start() { [[ "$GURI_SHOW_EXEC_TIME" == false ]] && return GURI_EXEC_TIME_START="$(date +%s)" @@ -148,5 +154,5 @@ add-zsh-hook preexec exec_time_start add-zsh-hook precmd exec_time_stop PROMPT=' -$(level_prompt_info)$(git_prompt_info)$fg[yellow]%2v$(dockerm_prompt_info)$(exec_time_prompt_info) +$(level_prompt_info)$(git_prompt_info)$fg[yellow]%2v$(zenv_prompt_info)$(exec_time_prompt_info) %{$fg_no_bold[white]%}%1v$(get_ret_status)%{$fg_no_bold[white]%}'