diff --git a/themes/bobthefish/fish_prompt.fish b/themes/bobthefish/fish_prompt.fish index eeec09c..ccbd524 100644 --- a/themes/bobthefish/fish_prompt.fish +++ b/themes/bobthefish/fish_prompt.fish @@ -310,25 +310,27 @@ function __bobthefish_prompt_dir -d 'Display a shortened form of the current dir end function __bobthefish_virtualenv_python_version -d 'Get current python version' - switch (readlink (which python)) + set -l python_version (readlink (which python)) + switch "$python_version" case python2 echo $__bobthefish_superscript_glyph[2] case python3 echo $__bobthefish_superscript_glyph[3] case pypy echo $__bobthefish_pypy_glyph - end -end - -function __bobthefish_virtualenv -d 'Get the current virtualenv' - echo $__bobthefish_virtualenv_glyph(__bobthefish_virtualenv_python_version) (basename "$VIRTUAL_ENV") + end end function __bobthefish_prompt_virtualfish -d "Display activated virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself)" set -q VIRTUAL_ENV; or return + set -l version_glyph (__bobthefish_virtualenv_python_version) + if test "$version_glyph" + __bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey + echo -n -s $__bobthefish_virtualenv_glyph $version_glyph + end __bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey set_color $__bobthefish_lt_grey --bold - echo -n -s (__bobthefish_virtualenv) ' ' + echo -n -s (basename "$VIRTUAL_ENV") ' ' set_color normal end