romkatv / powerlevel10k

A Zsh theme
MIT License
46.51k stars 2.19k forks source link

Show python version for pyenv #679

Closed eddyg closed 4 years ago

eddyg commented 4 years ago

Hi Roman.

I noticed there is a POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION and POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION, but when I tried to set POWERLEVEL9K_PYENV_SHOW_PYTHON_VERSION I didn't get the numeric version number added to my prompt (still had just the name).

❯ pyenv versions
  system
  2.7.18
  2.7.18/envs/project-two
  3.6.10
  3.6.10/envs/project-three
  project-three
* project-two (set by /Users/me/git/project-two/.python-version)
❯ pyenv version
project-two (set by /Users/me/git/project-two/.python-version)
❯ pyenv version-name
project-two
❯ python --version
Python 2.7.18
❯ echo $PYENV_VIRTUAL_ENV
/Users/me/.pyenv/versions/2.7.18/envs/project-two

So I see project-two in my prompt, but I'd like to see something like: project-two 2.7.18

Of course, if the pyenv version name and the Python numeric version are the same, it shouldn't show the numeric version.

Ideally, I'd like to be able to style the Python numeric version number separately from the pyenv env name. Perhaps via some generic parameters that would be used by VIRTUALENV, ANACONDA, and PYENV:

POWERLEVEL9K_PYTHON_VERSION_{PRE,SUF}FIX
POWERLEVEL9K_PYTHON_VERSION_BACKGROUND
POWERLEVEL9K_PYTHON_VERSION_FOREGROUND

but if not:

POWERLEVEL9K_PYENV_VERSION_{PRE,SUF}FIX
POWERLEVEL9K_PYENV_VERSION_BACKGROUND
POWERLEVEL9K_PYENV_VERSION_FOREGROUND

Thanks again for a fantastic prompt!

romkatv commented 4 years ago

I've added P9K_PYENV_PYTHON_VERSION. You can use it in POWERLEVEL9K_PYENV_CONTENT_EXPANSION. For example:

POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}'

In plain English this says:

($P9K_CONTENT is what you normally see without CONTENT_EXPANSION.)

Please give it a try and let me know whether it works for you.

eddyg commented 4 years ago

Thanks Roman. Your responsiveness is extremely impressive!

The POWERLEVEL9K_PYENV_CONTENT_EXPANSION above works as you described. 👍

However, when I tried to change the color of the python version by doing:

typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ %F{green}$P9K_PYENV_PYTHON_VERSION%f}'

it doesn't work. Is there a way to do that?

Also, out of curiosity, is there a reason you decided not to implement a POWERLEVEL9K_PYENV_SHOW_PYTHON_VERSION option for consistency with the virtualenv and anaconda segments?

Thanks again!

romkatv commented 4 years ago

However, when I tried to change the color...

Try it in plain zsh:

x=${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ %F{green}$P9K_PYENV_PYTHON_VERSION%f}

Error, right? You can simplify it to this: ${:+{}}. This doesn't work because the first } closes ${...}. You need to escape that } with backslash: \}.

Alternatively, you can use %2F instead of %F{green}. They are equivalent but the former doesn't have } that sometimes requires quoting.

Also, out of curiosity, is there a reason you decided not to implement a POWERLEVEL9K_PYENV_SHOW_PYTHON_VERSION option for consistency with the virtualenv and anaconda segments?

The solution I've implemented is more flexible. You have more freedom in terms of formatting (colors, etc.) and even conditional logic ("show python version only if different from pyenv version").

If this works well for pyenv, I'll add similar parameters for other segments and phase out the old SHOW_PYTHON_VERSION from config templates (the existing configs that powerlevel10k users have will keep working of course).

eddyg commented 4 years ago

Ah! I knew it had to be something simple that I was missing. (I think I've been burned by nested }'s closing ${ before. Maybe it will stick this time.)

And your explanation about this approach being more flexible makes perfect sense. I'm totally onboard with using this instead of adding another boolean parameter.

Once again, thanks so much for taking the time to explain things.

romkatv commented 4 years ago

Thanks for the high quality feature request and feedback. You keep powerlevel10k going.

xinbinhuang commented 4 years ago

Hi @romkatv , I encountered the same issue: could not see pyenv version in the prompt, but I have this line typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}' setup in the .p10k.zsh. So I am not sure what is happening here....

Here is the config part for pyenv:

################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################
  # Pyenv color.
  typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37
  # Hide python version if it doesn't come from one of these sources.
  typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global)
  # If set to false, hide python version if it's the same as global:
  # $(pyenv version-name) == $(pyenv global).
  typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
  # If set to false, hide python version if it's equal to "system".
  typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true

  # Pyenv segment format. The following parameters are available within the expansion.
  #
  # - P9K_CONTENT                Current pyenv environment (pyenv version-name).
  # - P9K_PYENV_PYTHON_VERSION   Current python version (python --version).
  #
  # The default format has the following logic:
  #
  # 1. Display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION" if $P9K_PYENV_PYTHON_VERSION is not
  #   empty and unequal to $P9K_CONTENT.
  # 2. Otherwise display just "$P9K_CONTENT".
  typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}'

  # Custom icon.
  # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
romkatv commented 4 years ago

Hi @romkatv , I encountered the same issue

Please describe the issue in your own words.

could not see pyenv version in the prompt

What's the output of the following command?

() {
  emulate -L zsh -o xtrace
  typeset -pm 'POWERLEVEL9K_*|ZSH_VERSION|*PYENV*|*pyenv*'
  pyenv version-name
  pyenv version
  pyenv global
}

Post a screenshot of your prompt after running this command and explain what you expect to see in prompt (presumably it's not the same thing as what you actually see in prompt).

xinbinhuang commented 4 years ago

@romkatv Thank you for the quick response!

Here is the output from the command

() {
function>   emulate -L zsh -o xtrace
function>   typeset -pm 'POWERLEVEL9K_*|ZSH_VERSION|*PYENV*|*pyenv*'
function>   pyenv version-name
function>   pyenv version
function>   pyenv global
function> }
+(anon):2> typeset -pm 'POWERLEVEL9K_*|ZSH_VERSION|*PYENV*|*pyenv*'
typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false
typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=''
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
typeset -g POWERLEVEL9K_TIMEWARRIOR_CONTENT_EXPANSION='${P9K_CONTENT:0:24}${${P9K_CONTENT:24}:+…}'
typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68
typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false
typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true
typeset -g POWERLEVEL9K_RIGHT_LEFT_WHITESPACE=''
typeset -g POWERLEVEL9K_RVM_FOREGROUND=168
typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=117
typeset -g POWERLEVEL9K_PLENV_FOREGROUND=67
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION=✘
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
typeset -g POWERLEVEL9K_RULER_CHAR=─
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true
typeset -g -a POWERLEVEL9K_LUAENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34
typeset -g POWERLEVEL9K_BACKGROUND=''
typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=37
typeset -g POWERLEVEL9K_GOENV_FOREGROUND=37
typeset -g POWERLEVEL9K_STATUS_ERROR=false
typeset -g POWERLEVEL9K_SWAP_FOREGROUND=96
typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=220
typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=166
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTED_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=37
typeset -g POWERLEVEL9K_CONTEXT_SUDO_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_SUDO_TEMPLATE=%n@%m
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=''
typeset -g POWERLEVEL9K_NODENV_FOREGROUND=70
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_CONTENT_EXPANSION=▶
typeset -g POWERLEVEL9K_AZURE_FOREGROUND=32
typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
typeset -g POWERLEVEL9K_VCS_STAGED_MAX_NUM=-1
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=37
typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED=false
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
typeset -g POWERLEVEL9K_SHOW_RULER=false
typeset -g -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( status command_execution_time background_jobs direnv asdf virtualenv                                          anaconda pyenv goenv nodenv nvm nodeenv rbenv rvm fvm luaenv jenv plenv phpenv haskell_stack kubecontext terraform aws                                          aws_eb_env azure gcloud google_app_cred context nordvpn ranger nnn vim_shell midnight_commander nix_shell todo timewar                                         rior taskwarrior time newline )
typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true
typeset -g -a POWERLEVEL9K_PLENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%B%n@%m
typeset -g POWERLEVEL9K_NNN_FOREGROUND=72
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160
typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=99
typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=32
typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=''
typeset -g -A _p9k__read_pyenv_like_version_file_cache=( )
typeset -g -i _POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=0
typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=161
typeset -g POWERLEVEL9K_RULER_FOREGROUND=242
typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168
typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=134
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=76
typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV                                         _PYTHON_VERSION}'
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=180
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTING_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi'
typeset -g POWERLEVEL9K_CONFIG_FILE=/home/guava/.p10k.zsh
typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false
typeset -g -a POWERLEVEL9K_PHPENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset -g _POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYEN                                         V_PYTHON_VERSION}'
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39
typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70
typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %70F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %215                                         F⇡$P9K_IP_TX_RATE}'
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_CONTENT_EXPANSION=❯
typeset -g -a POWERLEVEL9K_GOENV_SOURCES=( shell local global )
typeset -g -a POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( '*' DEFAULT )
typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=37
export PYENV_SHELL=zsh
typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=70
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_FOREGROUND=196
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}                                         }${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
typeset -g ZSH_VERSION=5.4.2
typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi'
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 '
typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=81
typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=' '
typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=208
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
typeset -g POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_NAME//\%/%%}'
typeset -g -a POWERLEVEL9K_VCS_BACKENDS=( git )
typeset -g POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION='${${${CONDA_PROMPT_MODIFIER#\(}% }%\)}'
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=38
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_TEMPLATE=%n@%m
typeset -g POWERLEVEL9K_DIR_FOREGROUND=31
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito'
typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=38
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=''
typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=37
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_CONTENT_EXPANSION=❮
typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=' '
typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER='(.bzr|.citc|.git|.hg|.node-version|.python-version|.go-version|.ruby-ver                                         sion|.lua-version|.java-version|.perl-version|.php-version|.tool-version|.shorten_folder_marker|.svn|.terraform|CVS|Car                                         go.toml|composer.json|go.mod|package.json|stack.yaml)'
typeset -g -a POWERLEVEL9K_NODENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_NORDVPN_CONNECTING_CONTENT_EXPANSION=''
typeset -g -a POWERLEVEL9K_RBENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_LEFT_LEFT_WHITESPACE=''
typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=32
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=''
typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
typeset -g POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM=-1
typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true
typeset -g POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37
typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=-1
typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=31
typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=110
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=✘
typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=67
typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_JENV_FOREGROUND=32
typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false
typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_CONTENT_EXPANSION=▶
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_FOREGROUND=76
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_CONTENT_EXPANSION=V
typeset -g POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}'
typeset -g POWERLEVEL9K_SHORTEN_DELIMITER=''
typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172
typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=178
typeset -g -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( os_icon dir vcs newline prompt_char )
typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs'
typeset -g POWERLEVEL9K_WIFI_FOREGROUND=68
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94
typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=32
typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76
typeset -g POWERLEVEL9K_NORDVPN_CONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_NODEENV_LEFT_DELIMITER=''
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_FOREGROUND=76
typeset -g POWERLEVEL9K_TIME_FOREGROUND=66
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160
typeset -g POWERLEVEL9K_STATUS_OK=false
typeset -g POWERLEVEL9K_GCLOUD_REFRESH_PROJECT_NAME_SECONDS=60
typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_FOREGROUND=76
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTED_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=37
typeset -g _POWERLEVEL9K_PYENV_FOREGROUND=37
typeset -g -a POWERLEVEL9K_ASDF_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_TODO_FOREGROUND=110
typeset -g POWERLEVEL9K_IP_FOREGROUND=38
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=''
typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_NVM_FOREGROUND=70
typeset -g POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=''
typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=168
typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi'
typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35
typeset -g POWERLEVEL9K_NODEENV_RIGHT_DELIMITER=''
typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=125
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=''
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=32
typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'
typeset -g POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM=-1
typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_SUDO_FOREGROUND=180
typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178
typeset -g POWERLEVEL9K_LOAD_WHICH=5
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_CONTENT_EXPANSION=❮
typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true
typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=70
typeset -g -i _POWERLEVEL9K_PYENV_SHOW_SYSTEM=1
typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT}'
typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66
typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39
typeset -g -i _POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=0
typeset -g -a POWERLEVEL9K_JENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}'
typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false
typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=32
typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=66
typeset -g POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND=70
typeset -g -a POWERLEVEL9K_PYENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76
typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}'
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=129
typeset -g -a POWERLEVEL9K_KUBECONTEXT_CLASSES=( '*' DEFAULT )
typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=37
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=70
typeset -g POWERLEVEL9K_RAM_FOREGROUND=66
typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=32
typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB=''
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70
typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false
typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
typeset -g POWERLEVEL9K_FVM_FOREGROUND=38
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_CONTENT_EXPANSION=V
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=''
typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=178
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=✔
typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=172
export PYENV_ROOT=/home/guava/.pyenv
typeset -g POWERLEVEL9K_LEFT_RIGHT_WHITESPACE=''
typeset -g POWERLEVEL9K_ICON_PADDING=none
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_FOREGROUND=196
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_FOREGROUND=76
typeset -g POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM=-1
export PYENV_VIRTUALENVWRAPPER_PYENV_VERSION=3.8.3
typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=74
typeset -g -a POWERLEVEL9K_TERRAFORM_CLASSES=( '*' DEFAULT )
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=✘
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
typeset -g POWERLEVEL9K_RIGHT_RIGHT_WHITESPACE=''
typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=99
typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=70
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_CONTENT_EXPANSION=❯
typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=160
typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=70
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
typeset -g POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=-1
typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION=✔
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_FOREGROUND=196
typeset -g POWERLEVEL9K_IP_INTERFACE='e.*'
typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=99
typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true
typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=134
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=70
typeset -g -a POWERLEVEL9K_HASKELL_STACK_SOURCES=( shell local )
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_FOREGROUND=196
typeset -g -a POWERLEVEL9K_AWS_CLASSES=( '*' DEFAULT )
typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true
typeset -g POWERLEVEL9K_RANGER_FOREGROUND=178
typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false
typeset -g -a _POWERLEVEL9K_PYENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103
+(anon):3> pyenv version-name
+pyenv:1> local command
+pyenv:2> command=version-name
+pyenv:3> [ 1 -gt 0 ']'
+pyenv:4> shift
+pyenv:7> case version-name (activate | deactivate | rehash | shell | virtualenvwrapper | virtualenvwrapper_lazy)
+pyenv:7> case version-name (*)
+pyenv:11> pyenv version-name
3.8.3
+(anon):4> pyenv version
+pyenv:1> local command
+pyenv:2> command=version
+pyenv:3> [ 1 -gt 0 ']'
+pyenv:4> shift
+pyenv:7> case version (activate | deactivate | rehash | shell | virtualenvwrapper | virtualenvwrapper_lazy)
+pyenv:7> case version (*)
+pyenv:11> pyenv version
3.8.3 (set by /home/guava/.pyenv/version)
+(anon):5> pyenv global
+pyenv:1> local command
+pyenv:2> command=global
+pyenv:3> [ 1 -gt 0 ']'
+pyenv:4> shift
+pyenv:7> case global (activate | deactivate | rehash | shell | virtualenvwrapper | virtualenvwrapper_lazy)
+pyenv:7> case global (*)
+pyenv:11> pyenv global
3.8.3

And here is the screent shot image

What I expect to see is to have the current python version (i.e. 3.8.3) on the right side of the prompt near the time. Currently there is nothing showing up.

romkatv commented 4 years ago

@xinbinhuang Open ~/.p10k.zsh and notice these lines:

# If set to false, hide python version if it's the same as global:
# $(pyenv version-name) == $(pyenv global).
typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false

The output you've posted indicates that pyenv version-name and pyenv global are both 3.8.3, hence pyenv segment is hidden.

You can try flipping the parameter's value to true.

P.S.

In the future please, when you have an issue, please open a new one instead of commenting on an exiting closed issue. From experience I can tell you that most of the time when someone says they have the same issue, it turns out to be not the same. This case isn't exceptional.

xinbinhuang commented 4 years ago

The output you've posted indicates that pyenv version-name and pyenv global are both 3.8.3, hence pyenv segment is hidden. You can try flipping the parameter's value to true.

Thank you so much! It solves the issue!

P.S. In the future please, when you have an issue, please open a new one instead of commenting on an exiting closed issue. From experience I can tell you that most of the time when someone says they have the same issue, it turns out to be not the same. This case isn't exceptional.

Thank you for reminding me on this. I will make sure to open an new issue in the future. Thank you so much again

Bin