Hi, I'm using p10k using the follwoing configuration wizard options:
# Wizard options: nerdfont-complete + powerline, small icons, rainbow, time,
# angled separators, sharp heads, flat tails, 2 lines, disconnected, no frame, sparse,
# many icons, fluent, transient_prompt, instant_prompt=verbose.
I have a pyenv-managed python (3.8.1) and a virtualenv created using it (named neovim-python3).
If I activate it, I see duplicate segments as below:

Is this an expected behavior, or can it be fixed?
I'm using:
zsh 5.7.1 (x86_64-apple-darwin19.0)
macOS Catalina (10.15.3)
Is it possible that you also have asdf installed and have legacy_version_file = yes in ~/.asdfrc?
No, I do not have asdf installed. But if it is relevant, I do have pyenv, pyenv-virtualenv, pipenv, and pipx.
Let's try to figure out which two segments are displaying the same information. Try hiding the following segments one by one and see when your prompt changes.
To hide segment foo, type the following command:
p10k display '*/foo'=hide
Thank you for a fast reply! I found out that the two were from 'pyenv' and 'virtualenv'. Since my neovim-python3 is using 3.8.1 python, is there a way to change the pyenv prompt to show 3.8.1, instead of the redundant neovim-python3?
What's the output of pyenv version-name when your prompt looks like on the screenshot?
It outputs neovim-python3.
This is the output of pyenv versions:
❯ pyenv versions
system
2.7.17
2.7.17/envs/neovim-python2
3.8.1
3.8.1/envs/neovim-python3
3.8.1/envs/tex-minted
neovim-python2
* neovim-python3 (set by PYENV_VERSION environment variable)
tex-minted
pyenv prompt segment is supposed to always display the same thing as pyenv version-name, so it's working as intended.
Try the following configuration options. Do they make your prompt behave the way you want?
# Display the output of `python --version` next to the virtual environment name.
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=true
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
# Hide `pyenv` segment if its content has no dots ('.').
typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${(M)P9K_CONTENT:#*.*}'
typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='${${(M)P9K_CONTENT:#*.*}:+${P9K_VISUAL_IDENTIFIER// }}'
The code to hide pyenv is a bit obscure but hopefully at least the comment is clear. Basically, you'll never see pyenv segment if its content (a.k.a. text) has no dots in it.

This is exactly what I wanted! Thank you :tada:
Great!
By the way, you can remove vi_mode from POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. Prompt symbol displays the same information. It changes depending on vi mode: ❯, ❮, Ⅴ, ▶ for insert, command, visual and replace mode respectively.
Also good to know! :)
Hi @romkatv ,
I was facing the same issue but your solution helped me a lot, thank you for this!
However, the python version which is displayed is not correct if you enable an environment via pyenv activate (see bottom right of the image attached). Can you also help me with this issue?

@tschmel Please try removing virtualenv from POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS and adding this parameter:
typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}'
Does this work the way you want?
Thanks for your fast response, it works like a charm! 👌
For future reference, this is what I had to add to my _.zshrc_ to get it running:
# Define right side elements (all besides virtualenvs)
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time background_jobs direnv asdf
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 vi_mode todo timewarrior taskwarrior time)
# Display pyenv and virtuelenv information in the expected format
typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}'
EDIT: Remove superfluous lines and fix comment (see below)
# Display the output of `python --version` next to the virtual environment name. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=true typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= # Hide `pyenv` segment if its content has no dots ('.'). typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${(M)P9K_CONTENT:#*.*}' typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='${${(M)P9K_CONTENT:#*.*}:+${P9K_VISUAL_IDENTIFIER// }}'
You need to delete these. My previous comment describes all changes that are necessary on top of a standard ~/.p10k.zsh.
virtualenv from POWERLEVEL9K_RIGHT_PROMPT_ELEMENTStypeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}'
You are absolutely right, I edited my previous comment accordingly.
By the way, this comment isn't accurate:
# Fix python version for pyenv virtualenvs
Parameter POWERLEVEL9K_PYENV_CONTENT_EXPANSION isn't fixing Python version. It defines the format of pyenv segment. Here's the logic of that parameter's value in plain English.
$P9K_PYENV_PYTHON_VERSION is not empty and unequal to $P9K_CONTENT, display $P9K_CONTENT $P9K_PYENV_PYTHON_VERSION.$P9K_CONTENT.($P9K_CONTENT is what you normally see in the prompt if you don't define POWERLEVEL9K_PYENV_CONTENT_EXPANSION.)
Thanks for the clarification. What about the following:
# Display pyenv and virtuelenv information in the expected format
My goal is for you to understand what the parameter does. If you do, comment is up to you as it goes into your config.
Hi, I'm facing a similar doubt, but with ASDF and python venvs. When I activate my venv, ASDF is still shown. Can ASDF be hidden when venvs are activated?

Thank you for powerlevel, it's amazing!
@jvcarli Add this to ~/.p10k.zsh:
function p10k-on-pre-prompt() {
if [[ -n ${VIRTUAL_ENV-} ]]; then
p10k display '*/asdf'=hide
else
p10k display '*/asdf'=show
fi
}
The restart zsh with exec zsh.
In the future please open a separate issue instead of commenting on a closed one.
Most helpful comment
pyenvprompt segment is supposed to always display the same thing aspyenv version-name, so it's working as intended.Try the following configuration options. Do they make your prompt behave the way you want?
The code to hide
pyenvis a bit obscure but hopefully at least the comment is clear. Basically, you'll never seepyenvsegment if its content (a.k.a. text) has no dots in it.