Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

how to reference another virtualenv plugin? #1392

Open
okakaino opened this issue Jan 8, 2020 · 3 comments
Open

how to reference another virtualenv plugin? #1392

okakaino opened this issue Jan 8, 2020 · 3 comments

Comments

@okakaino
Copy link

okakaino commented Jan 8, 2020

Hi, thanks for the hard work first.

I wanted to show virtualenv on my prompt, and I just found that as long as "virtualenv" is included here:

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(virtualenv context dir vcs)

virtualenv always displays, no matter whether I enable oh-my-zsh virtualenv plugin or not

plugins=(git pip python)

After long time of research and grep-ing, I found that virtualenv segment is determined in powerlevel9k.zsh-theme file:

prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"

[[ -z "$virtualenv_path" ]] && return

"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "${virtualenv_path:t}" 'PYTHON_ICON'
}

so how virtualenv displays is pretty fixed here, it is not asking any other plugin for the appearance. But my system is configured a little differently, so the default value is not accurate, and I'm not able to use my own plugin to determine how I want to display my virtual environment name, is this on purpose? How can I display the way I want, please?

@romkatv
Copy link

romkatv commented Jan 8, 2020

If I may ask, how do you want virtualenv to be displayed?

@okakaino
Copy link
Author

okakaino commented Jan 9, 2020

If I may ask, how do you want virtualenv to be displayed?

As defined in

${virtualenv_path:t}

the trailing folder name of virtualenv_path is used as the virtual environment, but my folder structure is like
Screen Shot 2020-01-08 at 11 54 53 PM
where >>test<< is what I want to show on prompt, but powerlevwl9k displays venv

I know I can replace

${virtualenv_path:t}

with

${virtualenv_path:h:t}

but is there a way to let powerlevel9k NOT to decide what to show as virtualenv, but surrender the ability to plugins like Autoswitch Python Virtualenv or virtualenv?

@romkatv
Copy link

romkatv commented Jan 9, 2020

Thanks for the helpful explanation. This is very reasonable. As far as I know, all users prefer what you want over the behavior of powerlevel9k.

but is there a way to let powerlevel9k NOT to decide what to show

There is no way to do what you want in powerlevel9k.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants