mavam / dotfiles

:desktop_computer: The very heart of an efficient work environment
51 stars 22 forks source link

Show Python virtualenv #8

Closed MacFlurry closed 5 years ago

MacFlurry commented 5 years ago

Hello,

could you add the possibility to see the virtual env status and it name ?

thanks a lot.

mavam commented 5 years ago

Something like this should do the trick:

diff --git a/zsh/.zshrc b/zsh/.zshrc
index 0c038b8..50e19e9 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -28,8 +28,8 @@ POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf46
 POWERLEVEL9K_STATUS_OK=false
 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir_joined
                                    dir_writable_joined)
-POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time vcs
-                                    background_jobs_joined time_joined
+POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time virtualenv
+                                    vcs background_jobs_joined time_joined
                                     user_joined os_icon_joined host_joined)
 POWERLEVEL9K_VCS_CLEAN_BACKGROUND="clear"
 POWERLEVEL9K_VCS_CLEAN_FOREGROUND="green"
@@ -73,6 +73,8 @@ POWERLEVEL9K_HOST_ICON="\uF109 " # 
 POWERLEVEL9K_SSH_ICON="\uF489 "  # 
 POWERLEVEL9K_OS_ICON_BACKGROUND="clear"
 POWERLEVEL9K_OS_ICON_FOREGROUND="grey"
+POWERLEVEL9K_PYTHON_ICON_BACKGROUND="clear"
+POWERLEVEL9K_PYTHON_ICON_FOREGROUND="cyan"

 # zsh-syntax-highlighting
 ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)

I can't get the colors to sync up, though, background and foreground colors don't seem to be accepted:

Screen Shot 2019-04-18 at 07 11 55

Mind playing with it a bit and submitting a PR?

MacFlurry commented 5 years ago

works pretty well, but the cyan background is not pretty. could you remove the background ?

best :-)

mavam commented 5 years ago

These two settings tweak the colors:

POWERLEVEL9K_PYTHON_ICON_BACKGROUND="clear"
POWERLEVEL9K_PYTHON_ICON_FOREGROUND="cyan"

However, they don't seem to work like all the other setting. My hunch is that this is a bug with powerlevel9k.

MacFlurry commented 5 years ago

Yeah. seems like :-)

MacFlurry commented 5 years ago

offtopic: I'm trying to add "public_ip"

POWERLEVEL9K_IP_INTERFACE=true
POWERLEVEL9K_PUBLIC_IP_HOST=true
POWERLEVEL9K_PUBLIC_IP_TIMEOUT=true

and

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time virtualenv 
                                    vcs background_jobs_joined
                                    time_joined user_joined os_icon_joined 
                                    host_joined public_ip)

I sourced the zshrc

source .dotfiles/zsh/.zshrc

But it fails with this output:

stat: cannot read file system information for '%m': No such file or directory prompt_publicip:15: bad math expression: operand expected at `"/tmp/p9k...'

Any clue ? :-)

thanks for your help

mavam commented 5 years ago

I've opened an issue in the powerlevel9k repo for this bug.

MacFlurry commented 5 years ago

I don't know if you saw this

mavam commented 5 years ago

Yeah, I saw it, but since it's a bit off-topic I quickly swapped it out again. :)

Adding public_ip_joined (and also public_ip) works for me, by the way:

Screen Shot 2019-08-08 at 12 40 05
mavam commented 5 years ago

The virtual environments are supported as of 15c4ce2.