From 8a9ed776b45807af27e2cedc2e1dfb3c5a3c7c33 Mon Sep 17 00:00:00 2001 From: acicchetti Date: Thu, 14 Mar 2019 15:07:35 -0400 Subject: [PATCH] Added venv support because the default is broken --- zsh/zshrc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 7e3a477..b6cb6b7 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -54,6 +54,18 @@ antigen apply # custom functions for powerlevel9k POWERLEVEL9K_ELIXIR_ICON=$'🥃' +POWERLEVEL9K_PYTHON_ICON=$'\U1F40D' + +prompt_custom_virtualenv() { + local virtualenv_path="$VIRTUAL_ENV" + if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then + local python_version="$(python --version | cut -d ' ' -f 2)" + echo -n "$POWERLEVEL9K_PYTHON_ICON $(python --version) in $(basename $(dirname $virtualenv_path))" + fi +} +POWERLEVEL9K_CUSTOM_VIRTUALENV="prompt_custom_virtualenv" + + prompt_asdf_elixir() { if [ $commands[asdf] ]; then ELIXIR_ICON=$'🥃' @@ -79,7 +91,7 @@ export POWERLEVEL9K_IGNORE_TERM_COLORS=true export POWERLEVEL9K_PROMPT_ON_NEWLINE=true export POWERLEVEL9K_PROMPT_ADD_NEWLINE=true export POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_writable vcs custom_asdf_elixir) -export POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv command_execution_time) +export POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_virtualenv command_execution_time) export VIRTUAL_ENV_DISABLE_PROMPT=1