Closed ymage closed 5 years ago
i still can't get the segment to show, any help would be appreciated
@surajsharma Does it work with Powerlevel10k? If not, then what's the output of echo $VIRTUAL_ENV
when you are expecting but not seeing virtualenv prompt segment?
Powerlevel10k is what i am having trouble with, worked fine in 9k.
in 10k, when i do echo $VIRTUAL_ENV
i'm getting a blank line (see screenshot)
https://puu.sh/DA5oS/d4a230f308.png
@surajsharma Got it. Usually it's best to raise issues against Powerlevel10k at https://github.com/romkatv/powerlevel10k/. If there is a bug and it affects p9k as well, I'll open an issue against p9k.
Let's double check whether p9k displays virtualenv. If it does, I'll open an issue at p10k and we'll continue there. If it doesn't work p9k either, we'll stay here.
Please replace powerlevel10k with powerlevel9k in your config and see if virtualenv shows up. If it does, what's the output of echo $VIRTUAL_ENV
again?
i can confirm that p9k displays virtualenv directory with echo $VIRTUAL_ENV
however, it still doesn't display the segment.
This is getting interesting. Here's how virtualenv is implemented in p9k:
prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"
# Early exit; $virtualenv_path must always be set.
[[ -z "$virtualenv_path" ]] && return
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "${virtualenv_path:t}" 'PYTHON_ICON'
}
As you can see, it has an early exit if $VIRTUAL_ENV
is empty. Something else must be going on.
Please post the following:
typeset -m 'POWERLEVEL9K_*'
.Here are the things you requested:
output of typeset -m 'POWERLEVEL9K_*'
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=false
POWERLEVEL9K_VCS_STAGED_MAX_NUM=1
POWERLEVEL9K_VCS_LOADING_TEXT=loading
POWERLEVEL9K_VPN_IP_INTERFACE=tun
POWERLEVEL9K_SHOW_RULER=false
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( status root_indicator background_jobs history time )
POWERLEVEL9K_VCS_LOADING_ACTIONFORMAT_FOREGROUND=red
POWERLEVEL9K_DIR_PATH_SEPARATOR=/
POWERLEVEL9K_VCS_UNTRACKED_ACTIONFORMAT_FOREGROUND=red
POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND=red
POWERLEVEL9K_ANACONDA_LEFT_DELIMITER='('
POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true
POWERLEVEL9K_CHRUBY_SHOW_VERSION=true
POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=' '
POWERLEVEL9K_BATTERY_STAGES=''
POWERLEVEL9K_VCS_HIDE_TAGS=false
POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM=1
POWERLEVEL9K_IP_INTERFACE='^[^ ]+'
POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
POWERLEVEL9K_MODE=''
POWERLEVEL9K_IGNORE_TERM_LANG=false
POWERLEVEL9K_STATUS_VERBOSE=true
POWERLEVEL9K_USER_TEMPLATE=%n
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=false
POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE=''
POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
POWERLEVEL9K_LOAD_WHICH=5
POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=false
POWERLEVEL9K_VCS_CLEAN_ACTIONFORMAT_FOREGROUND=red
POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
POWERLEVEL9K_VCS_GIT_HOOKS=( vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname )
POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=( )
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
Screenshot showing p9k prompt with virtualenv.
Command that you are using to enable virtual environment. https://puu.sh/DBX1t/228370965b.png
thank you for all the help!
output of typeset -m 'POWERLEVEL9K_*'
The output you've posted looks truncated. You might have better luck dumping it to a file and then attaching the file.
typeset -m 'POWERLEVEL9K_*' >~/p9k-cfg.txt
After running this command, you'll have p9k-cfg.txt
in your home directory. Please attach it to the issue.
Screenshot showing p9k prompt with virtualenv. https://puu.sh/DBX1t/228370965b.png
This screenshot doesn't have virtual environment in the prompt.
virtualenv
prompt is really quite simple. It just shows the tail of $VIRTUAL_ENV
, and it's identical in Powerlevel9k and Powerlevel10k. If echo $VIRTUAL_ENV
prints nothing, neither theme will show virtual environment.
p9k-cfg.txt thanks for the help, i've attached the file as you requested. Also, there is a virtualenv in the directory, here's another screenshot proving that.
Thanks, now I can see what's going on.
When you typed echo $VIRTUAL_ENV
while virtual environment was active, there was output. This is good and expected. However, your prompt doesn't show virtual environment status because you didn't tell Powerlevel10k that you want to see it.
Powerlevel10k (and 9k) can show a lot of information in the prompt but it's not all shown by default. You have to explicitly specify that you want virtualenv
. You do this by adding it to POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS
or POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
.
Try executing the following command and then restarting your shell and activating virtual environment.
echo 'POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs virtualenv time )' >>! ~/.zshrc
You should see virtual environment indicator in the right prompt when it's active.
it worked! thank you so much for all the help!!! :)
will the same work for both p9 and p10k?
Describe Your Issue
virtualenv prompt is broken : is never displayed within any virtualenv
Have you tried to debug or fix it?
After some tests, it seems $VIRTUAL_ENV_DISABLE_PROMPT is mishandled
Environment Information