reobin / typewritten

A minimal, lightweight, informative zsh prompt theme

Home Page:https://typewritten.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to show virtualenv?

henryla92 opened this issue · comments

Hi there,

How do I get virtualenv to show up using this theme?

Thanks!

Hi @henryla92 !

I've been using the theme for a couple of months and actually have no problem displaying the virtual env on my setup, and I don't think I have a specific config for that.

Screen Shot 2020-05-21 at 22 57 10

The theme doesn't handle virtualenv and leaves the default behaviour do its thing.
It could definitely handle it in the future though.

Where would you personally place the virtualenv info? I'm up for suggestions

So I just did some tests, and it happens that if you have the virtualenv plugin listed in your zsh plugins, the virtualenv doesn't show by default, and needs to be added in by the theme with something like this:

function virtualenv_info {
    [ $VIRTUAL_ENV ] && echo ‘(‘`basename $VIRTUAL_ENV`’) ‘
}
PROMPT='$(virtualenv_info)...'

Removing the virtualenv plugin from the list, and restarting your session makes it appear again. If the code above was to be implemented as well, then 2 virtualenv tags would appear.

Could you confirm this by telling me if you have the plugin listed in your ~/.zshrc? Like this:

plugins=(
  ...
  virtualenv
  ...
)

I could add this to the theme, but all users would need to add the virtualenv plugin so that the (env) tag doesn't get duplicated.

Seems like VIRTUAL_ENV_DISABLE_PROMPT=1 could be added to the code to make sure the virtualenv display would be handled by the theme and not elsewhere.

So it all could be handled by the theme after all. I’m gonna do some more research to make sure it’s a good idea to do so.

Ahh thank you!

Screen Shot 2020-05-21 at 22 57 10

@reobin Could you give us some details on that setup 👀

@jletey

That's the default virtual env display when you source it, from my experience anyway.

I noticed that having virtualenv listed in the ohmyzsh plugins removes it. That's why I mentionned that maybe it could be handled by typewritten, so that it would displaying at all times, plugin or not.

Do you not have this display when you source a virtual env?

@reobin No I meant the terminal theme/setup 😅

@jletey Oh ahah, that's my bad.

Terminal: iTerm2 (with window style set as no title bar)
Font: JetBrains Mono
colors: seoul256 (They have an iterm2 color scheme in there somewhere)

I think that's it