From 7ff4d6a3b3f74b9cb686dc4b00643358cc4817de Mon Sep 17 00:00:00 2001 From: Maximilian Schambach Date: Fri, 9 Feb 2024 12:54:58 +0100 Subject: [PATCH 1/3] Add option to hide python version --- README.md | 3 ++- functions/fish_prompt.fish | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ddd26f1..4eec13f 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ This theme is based loosely on [agnoster][btf-agnoster]. ### Configuration -You can override some of the following default options in your `config.fish`: +You can override some of the following default options in your `config.fish` or `.conf/omf/init.fish`: ```fish set -g theme_display_git no @@ -83,6 +83,7 @@ set -g theme_display_docker_machine no set -g theme_display_k8s_context yes set -g theme_display_hg yes set -g theme_display_virtualenv no +set -g theme_hide_python_version yes set -g theme_display_nix no set -g theme_display_ruby no set -g theme_display_node yes diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 1ec90fd..3fa5b8f 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -50,6 +50,7 @@ # set -g fish_prompt_pwd_dir_length 0 # set -g theme_project_dir_length 1 # set -g theme_newline_cursor yes +# set -g theme_hide_python_version yes # ============================== @@ -869,7 +870,11 @@ function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual e if [ "$version_glyph" ] __bobthefish_start_segment $color_virtualfish - echo -ns $virtualenv_glyph $version_glyph ' ' + if [ "$theme_hide_python_version" = yes ] + echo -ns $virtualenv_glyph + else + echo -ns $virtualenv_glyph $version_glyph ' ' + end end if [ "$VIRTUAL_ENV" ] From 01c546af5162f9f02a76f718b9ec1bab3439e7ab Mon Sep 17 00:00:00 2001 From: Maximilian Schambach Date: Mon, 12 Feb 2024 10:42:09 +0100 Subject: [PATCH 2/3] Update virtualenv python version prompt --- README.md | 1 + functions/fish_prompt.fish | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4eec13f..e043b42 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ set -g theme_display_docker_machine no set -g theme_display_k8s_context yes set -g theme_display_hg yes set -g theme_display_virtualenv no +set -g theme_display_virtualenv verbose set -g theme_hide_python_version yes set -g theme_display_nix no set -g theme_display_ruby no diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 3fa5b8f..e26a84f 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -33,6 +33,7 @@ # set -g theme_display_aws_vault_profile yes # set -g theme_display_hg yes # set -g theme_display_virtualenv no +# set -g theme_display_virtualenv verbose # set -g theme_display_nix no # set -g theme_display_ruby no # set -g theme_display_user ssh @@ -50,8 +51,6 @@ # set -g fish_prompt_pwd_dir_length 0 # set -g theme_project_dir_length 1 # set -g theme_newline_cursor yes -# set -g theme_hide_python_version yes - # ============================== # Helper methods @@ -867,14 +866,22 @@ function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual e and return set -l version_glyph (__bobthefish_virtualenv_python_version) + set -l prompt_style 'default' if [ "$version_glyph" ] __bobthefish_start_segment $color_virtualfish - if [ "$theme_hide_python_version" = yes ] - echo -ns $virtualenv_glyph - else + if string match -q "Python 2*" (python --version 2>&1 | string trim) + set prompt_style 'verbose' + else if [ "$theme_display_virtualenv" = 'verbose' ] + set prompt_style 'verbose' + end + + if [ "$prompt_style" = 'verbose' ] echo -ns $virtualenv_glyph $version_glyph ' ' + else + echo -ns $virtualenv_glyph end + end if [ "$VIRTUAL_ENV" ] From 1ec3bba060d5c65894197e9365347847b98b2cbe Mon Sep 17 00:00:00 2001 From: Maximilian Schambach Date: Mon, 12 Feb 2024 10:43:14 +0100 Subject: [PATCH 3/3] Remove old option from readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e043b42..ddc8121 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,6 @@ set -g theme_display_k8s_context yes set -g theme_display_hg yes set -g theme_display_virtualenv no set -g theme_display_virtualenv verbose -set -g theme_hide_python_version yes set -g theme_display_nix no set -g theme_display_ruby no set -g theme_display_node yes