Skip to content

added conda virtual env name to prompt #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions typewritten.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,23 @@ tw_current_directory="%F{$tw_current_directory_color}%c"
tw_verbose_current_directory="%F{$tw_current_directory_color]}%~"
tw_arrow="%F{$tw_colors[arrow]}->"

tw_redraw() {
local tw_virtual_env=""
if [[ ! -z $VIRTUAL_ENV ]] && [[ -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
tw_virtual_env="%F{$tw_colors[virtual_env]}($(basename $VIRTUAL_ENV)) "
tw_get_virtual_env() {
if [[ -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
local tw_virtual_env=""
if [[ ! -z $VIRTUAL_ENV ]]; then
tw_virtual_env="$VIRTUAL_ENV"
elif [[ ! -z $CONDA_PREFIX ]]; then
tw_virtual_env="$CONDA_PREFIX"
fi;

if [[ $tw_virtual_env != "" ]]; then
echo "%F{$tw_colors[virtual_env]}($(basename $tw_virtual_env)) "
fi;
fi;
}

tw_env_prompt="$tw_virtual_env$tw_prompt"
tw_redraw() {
tw_env_prompt="$(tw_get_virtual_env)$tw_prompt"

tw_layout="$TYPEWRITTEN_PROMPT_LAYOUT"
tw_git_info="$tw_prompt_data[tw_git_branch]$tw_prompt_data[tw_git_status]"
Expand Down