From 25e93443bb3e591fd650f06b207804b14e073471 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 5 Jan 2019 17:42:56 -0800 Subject: [PATCH 01/52] Add a colorscheme inspired by the Jellybeans colorscheme for Vim. All the colors were extracted from the Vim theme here: https://github.com/nanotech/jellybeans.vim I've tried to arrange things in a way that uses well associated colors (green, red, yellow for working tree state, etc) and provides reasonably high constrast in all cases. That said, I'm not an artist or design person, so totally open to suggestions here. --- functions/__bobthefish_colors.fish | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index 162959b..ad6673a 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -579,6 +579,61 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_virtualgo $base09 $colorfg --bold set -x color_desk $base09 $colorfg --bold + case 'jellybeans' # https://github.com/nanotech/jellybeans.vim + set -l bg 151515 + set -l darker_grey 1c1c1c + set -l dark_grey 262626 + set -l grey 888888 + set -l blue_grey a0a8b0 + set -l light_grey d8dee9 + set -l white ffffff + set -l dark_red 902020 + set -l red cf6a4c + set -l red_orange ffb964 + set -l bright_orange fad07a + set -l pale_gold dad085 + set -l pink f0a0c0 + set -l lilac c6b6ee + set -l dark_blue 2b5b77 + set -l deep_blue 0d61ac + set -l blue 8197bf + set -l bright_blue 7697d6 + set -l cyan 8fbfdc + set -l blue_green 668799 + set -l green 799d6a + set -l bright_green 70b950 + set -l brighter_green 65c254 + set -l light_green 99ad6a + set -l dark_green 556633 + + set -x color_initial_segment_exit $dark_red $white --bold + set -x color_initial_segment_su $red_orange $darker_grey --bold + set -x color_initial_segment_jobs $lilac $darker_grey --bold + + set -x color_path $dark_grey $light_grey + set -x color_path_basename $dark_grey $light_grey --bold + set -x color_path_nowrite $dark_grey $red_orange + set -x color_path_nowrite_basename $dark_grey $red_orange --bold + + set -x color_repo $light_green $darker_grey + set -x color_repo_work_tree $dark_grey $light_grey --bold + set -x color_repo_dirty $red $darker_grey + set -x color_repo_staged $pale_gold $darker_grey + + set -x color_vi_mode_default $bright_blue $darker_grey --bold + set -x color_vi_mode_insert $lilac $darker_grey --bold + set -x color_vi_mode_visual $cyan $darker_grey --bold + + set -x color_username $dark_grey $blue_grey --bold + set -x color_hostname $dark_grey $blue_grey + + set -x color_vagrant $lilac $darker_grey --bold + set -x color_k8s $pale_gold $darker_grey --bold + set -x color_rvm $pink $darker_grey --bold + set -x color_virtualfish $cyan $darker_grey --bold + set -x color_virtualgo $light_green $darker_grey --bold + set -x color_desk $light_grey $darker_grey --bold + case '*' # default dark theme # light medium dark # ------ ------ ------ From 12d5be5c863f0ef9b320253ff5ce1c81c96df8e4 Mon Sep 17 00:00:00 2001 From: Josselin Auguste Date: Sun, 14 Jun 2020 11:38:58 +0200 Subject: [PATCH 02/52] Add gruvbox light theme --- README.md | 2 +- functions/__bobthefish_colors.fish | 42 ++++++++++++++++++++++++ functions/bobthefish_display_colors.fish | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 85a6550..758fdc7 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ one of the following options to change the prompt colors. - `base16` (or `base16-dark`), `base16-light`. Dark and light variants of the default Base16 theme. - `zenburn`. An adaptation of Zenburn. -- `gruvbox`. An adaptation of gruvbox. +- `gruvbox`, `gruvbox-light`. An adaptation of gruvbox dark and light variants. - `dracula`. An adaptation of dracula. - `nord`. An adaptation of nord. diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index 1ee71d2..7f20853 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -482,6 +482,48 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_desk $blue[2] $fg[2] --bold set -x color_nix $blue[2] $fg[2] --bold + case 'gruvbox-light' + # light medium dark darkest + # ------ ------ ------ ------- + set -l red 9d0006 cc241d + set -l green 79740e 98971a + set -l yellow b57614 d79921 + set -l aqua 427b58 689d6a + set -l blue 076678 458588 + set -l grey a89984 928374 + set -l orange af3a03 d65d0e + set -l fg 282828 3c3836 504945 7c6f64 + set -l bg d5c4a1 fbf1c7 + + set -x color_initial_segment_exit $red[1] $bg[2] --bold + set -x color_initial_segment_su $fg[1] $green[2] --bold + set -x color_initial_segment_jobs $fg[1] $aqua[2] --bold + + set -x color_path $bg[1] $fg[2] + set -x color_path_basename $bg[1] $fg[2] --bold + set -x color_path_nowrite $red[1] $bg[2] + set -x color_path_nowrite_basename $red[1] $bg[2] --bold + + set -x color_repo $green[2] $fg[1] + set -x color_repo_work_tree $bg[1] $fg[2] --bold + set -x color_repo_dirty $orange[2] $bg[2] + set -x color_repo_staged $yellow[1] $bg[1] + + set -x color_vi_mode_default $fg[4] $bg[2] --bold + set -x color_vi_mode_insert $blue[1] $bg[2] --bold + set -x color_vi_mode_visual $yellow[1] $bg[2] --bold + + set -x color_vagrant $blue[2] $fg[2] --bold + set -x color_k8s $green[2] $fg[2] --bold + set -x color_username $fg[3] $blue[2] --bold + set -x color_hostname $fg[3] $blue[2] + set -x color_rvm $red[2] $bg[2] --bold + set -x color_nvm $green[1] $fg[2] --bold + set -x color_virtualfish $blue[2] $fg[2] --bold + set -x color_virtualgo $blue[2] $fg[2] --bold + set -x color_desk $blue[2] $fg[2] --bold + set -x color_nix $blue[2] $fg[2] --bold + case 'dracula' # https://draculatheme.com set -l bg 282a36 set -l current_line 44475a diff --git a/functions/bobthefish_display_colors.fish b/functions/bobthefish_display_colors.fish index e1dfc62..7fd9794 100644 --- a/functions/bobthefish_display_colors.fish +++ b/functions/bobthefish_display_colors.fish @@ -3,7 +3,7 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo set -l color_schemes default light \ solarized solarized-light \ base16 base16-light \ - gruvbox zenburn \ + gruvbox gruvbox-light zenburn \ dracula nord \ terminal terminal-dark-white \ terminal-light terminal-light-black \ From 69a0191e94dcf136a602c0e97f43eaf4414bfd78 Mon Sep 17 00:00:00 2001 From: Josselin Auguste Date: Tue, 27 Oct 2020 19:30:26 +0100 Subject: [PATCH 03/52] Add gruvbox-light screenshot --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 758fdc7..62e7290 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ set -g theme_newline_prompt '$ ' | ![solarized][btf-solarized] | ![solarized-light][btf-solarized-light] | | ![base16][btf-base16] | ![base16-light][btf-base16-light] | | ![zenburn][btf-zenburn] | ![terminal-dark][btf-terminal-dark] | -| ![nord][btf-nord] | | +| ![nord][btf-nord] | ![gruvbox-light][gruvbox-light] | You can use the function `bobthefish_display_colors` to preview the prompts in any color scheme. @@ -246,3 +246,4 @@ end [btf-zenburn]: https://cloud.githubusercontent.com/assets/53660/16141580/06229dd4-3412-11e6-84aa-a48de127b6da.png "zenburn" [btf-terminal-dark]: https://cloud.githubusercontent.com/assets/53660/16141583/0b3e8eea-3412-11e6-8068-617c5371f6ea.png "terminal-dark" [btf-nord]: https://user-images.githubusercontent.com/39213657/72811435-f64ca800-3c5f-11ea-8711-dcce8cfc50fb.png "nord" +[gruvbox-light]: https://user-images.githubusercontent.com/458535/97345492-6a207e80-188a-11eb-92df-30f33419238b.png "gruvbox-light" From 3bd40175ebc436ec89a771af03281032841a1cc6 Mon Sep 17 00:00:00 2001 From: Pavel Zaikin Date: Mon, 25 Oct 2021 11:36:58 +0500 Subject: [PATCH 04/52] show git tags if any Without change tags not shown (because return happen earlier). With change tags shown if exists. --- functions/fish_prompt.fish | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 02bfe97..b9037d4 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -78,6 +78,9 @@ function __bobthefish_escape_regex -a str -d 'A backwards-compatible `string esc end function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)' + set -l tag (command git describe --tags --exact-match 2>/dev/null) + and echo "$tag_glyph $tag " + set -l branch (command git symbolic-ref HEAD 2>/dev/null | string replace -r '^refs/heads/' '') and begin [ -n "$theme_git_default_branches" ] @@ -97,10 +100,6 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish and return end - set -l tag (command git describe --tags --exact-match 2>/dev/null) - and echo "$tag_glyph $tag" - and return - set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null) echo "$detached_glyph $branch" end From 332f23abd7a095d5b2c024a061af7b890a4f0c20 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Fri, 5 Nov 2021 10:16:55 -0400 Subject: [PATCH 05/52] Use more portable `uname -n` rather than `hostname`. Fixes #312 --- functions/fish_prompt.fish | 2 +- functions/fish_title.fish | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 02bfe97..6b441b5 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -690,7 +690,7 @@ end # Polyfill for fish < 2.5.0 if not type -q prompt_hostname if not set -q __bobthefish_prompt_hostname - set -g __bobthefish_prompt_hostname (hostname | string replace -r '\..*' '') + set -g __bobthefish_prompt_hostname (uname -n | string replace -r '\..*' '') end function prompt_hostname diff --git a/functions/fish_title.fish b/functions/fish_title.fish index a14e1b6..67f34d2 100644 --- a/functions/fish_title.fish +++ b/functions/fish_title.fish @@ -8,7 +8,7 @@ function __bobthefish_title_user -S -d 'Display actual user if different from $d if [ "$theme_title_display_user" = 'yes' ] if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ] set -l IFS . - hostname | read -l hostname __ + uname -n | read -l hostname __ echo -ns (whoami) '@' $hostname ' ' end end From 2c080cecedcc932248f697bd604875eb01f95d8a Mon Sep 17 00:00:00 2001 From: Victor Bersy Date: Tue, 28 Dec 2021 14:08:56 +0100 Subject: [PATCH 06/52] Fix k8s colors --- functions/__bobthefish_colors.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index 1ee71d2..b8b454f 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -516,7 +516,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_vi_mode_visual $orange $bg --bold set -x color_vagrant $pink $bg --bold - set -x color_k8s $green $fg --bold + set -x color_k8s $purple $bg --bold set -x color_aws_vault $comment $yellow --bold set -x color_aws_vault_expired $comment $red --bold set -x color_username $selection $cyan --bold From e69150081b0e576ebb382487c1ff2cb35e78bb35 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 28 Dec 2021 08:44:59 -0500 Subject: [PATCH 07/52] Add k8s-context segment to bobthefish_display_colors --- functions/bobthefish_display_colors.fish | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/bobthefish_display_colors.fish b/functions/bobthefish_display_colors.fish index e1dfc62..9719b27 100644 --- a/functions/bobthefish_display_colors.fish +++ b/functions/bobthefish_display_colors.fish @@ -140,6 +140,7 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo __bobthefish_start_segment $color_desk echo -ns $desk_glyph desk ' ' __bobthefish_finish_segments + echo __bobthefish_start_segment $color_aws_vault echo -ns aws-vault ' (' active ') ' @@ -149,5 +150,9 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo echo -ns aws-vault ' (' expired ') ' __bobthefish_finish_segments + __bobthefish_start_segment $color_k8s + echo -ns $k8s_glyph ' k8s-context' + __bobthefish_finish_segments + echo -e "\n" end From 1eaed8c39951029fa7839859abd5518977a80f83 Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Wed, 2 Feb 2022 23:15:51 -0800 Subject: [PATCH 08/52] Add more options to conditionally show node version (#315) --- README.md | 2 +- functions/fish_prompt.fish | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 85a6550..ddd26f1 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ set -g theme_newline_prompt '$ ' **Prompt options** - `theme_display_ruby`. Use `no` to completely hide all information about Ruby version. By default Ruby version displayed if there is the difference from default settings. -- `theme_display_node`. If set to `yes`, will display current NVM or FNM node version. +- `theme_display_node`. If set to `always`, will display current NPM, NVM or FNM node version. If set to `yes`, will display the version if an `.nvmrc`, `.node-version` or `package.json` file is found in the parent directories. - `theme_display_vagrant`. This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported. - `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator. - `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`). diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 6b441b5..4549b63 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -895,9 +895,42 @@ function __bobthefish_prompt_desk -S -d 'Display current desk environment' set_color normal end +function __bobthefish_prompt_find_file_up -S -d 'Find file(s), going up the parent directories' + set -l dir "$argv[1]" + set -l files $argv[2..] + + if test -z "$dir" + or test -z "$files" + return 1 + end + + while [ "$dir" ] + for f in $files + if [ -e "$dir/$f" ] + return + end + end + + [ "$dir" = '/' ] + and return 1 + + set dir (__bobthefish_dirname "$dir") + end + return 1 +end + function __bobthefish_prompt_node -S -d 'Display current node version' - [ "$theme_display_node" = 'yes' -o "$theme_display_nvm" = 'yes' ] - or return + set -l should_show + + if [ "$theme_display_node" = 'always' -o "$theme_display_nvm" = 'yes' ] + set should_show 1 + else if [ "$theme_display_node" = 'yes' ] + __bobthefish_prompt_find_file_up "$PWD" package.json .nvmrc .node-version + and set should_show 1 + end + + [ -z "$should_show" ] + and return set -l node_manager set -l node_manager_dir From 14a6f2b317661e959e13a23870cf89274f867f12 Mon Sep 17 00:00:00 2001 From: Shane Mook <614347+smook1980@users.noreply.github.com> Date: Tue, 5 Apr 2022 12:16:16 -0500 Subject: [PATCH 09/52] Update ruby asdf support for output of asdf v0.8.1 (#305) - asdf not output three columns for for `asdf current version`, the first being the plugin name - Update the provenance format to match --- functions/fish_prompt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 4549b63..331bc5b 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -830,10 +830,10 @@ function __bobthefish_prompt_rubies -S -d 'Display current Ruby information' set -l asdf_current_ruby (asdf current ruby 2>/dev/null) or return - echo "$asdf_current_ruby" | read -l asdf_ruby_version asdf_provenance + echo "$asdf_current_ruby" | read -l _asdf_plugin asdf_ruby_version asdf_provenance # If asdf changes their ruby version provenance format, update this to match - [ (string trim -- "$asdf_provenance") = "(set by $HOME/.tool-versions)" ] + [ (string trim -- "$asdf_provenance") = "$HOME/.tool-versions" ] and return set ruby_version $asdf_ruby_version From 14345095690199a039622fd06f043d89187eb10e Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 10 Jun 2022 15:23:32 -0700 Subject: [PATCH 10/52] Add Go prompt --- functions/fish_prompt.fish | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 331bc5b..e2b7731 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -35,6 +35,7 @@ # set -g theme_display_virtualenv no # set -g theme_display_nix no # set -g theme_display_ruby no +# set -g theme_display_go no # set -g theme_display_user ssh # set -g theme_display_hostname ssh # set -g theme_display_sudo_user yes @@ -803,6 +804,22 @@ function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM' end end +function __bobthefish_prompt_golang -S -d 'Display current Go information' + [ "$theme_display_go" = 'no' ] + and return + + set -l go_version + if type -fq go + set go_version (go version | cut --delimiter=' ' -f 3 | cut --characters='3-6' ) + end + + [ -z "$go_version" ] + and return + + __bobthefish_start_segment $color_virtualgo + echo -ns $go_glyph $go_version ' ' +end + function __bobthefish_prompt_rubies -S -d 'Display current Ruby information' [ "$theme_display_ruby" = 'no' ] and return @@ -1172,6 +1189,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' __bobthefish_prompt_nix __bobthefish_prompt_desk __bobthefish_prompt_rubies + __bobthefish_prompt_golang __bobthefish_prompt_virtualfish __bobthefish_prompt_virtualgo __bobthefish_prompt_node From 9ca1260fc596869b7eff2d2f655cbff37982ffc2 Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 11:24:14 -0700 Subject: [PATCH 11/52] Rework `__bobthefish_prompt_golang` to be more like "rubies" prompt First checks to see if `asdf` is installed. If it is, checks to see if either of the plugins ( `golang` or `go-sdk` ) that install a version of Go have an installed version. If they do, use that version. If `asdf` isn't installed, check the `go.mod` file. If in a folder that has a `go.mod` or a parent folder has a `go.mod`, check that file for the Go version. Lastly, check if there's a `go` executable on the current path. If there isn't set a flag so that the go version will be printed out in red rather than blue. --- functions/fish_prompt.fish | 98 +++++++++++++++++++++++++++++++------- 1 file changed, 82 insertions(+), 16 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index e2b7731..0a8fda2 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -804,22 +804,6 @@ function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM' end end -function __bobthefish_prompt_golang -S -d 'Display current Go information' - [ "$theme_display_go" = 'no' ] - and return - - set -l go_version - if type -fq go - set go_version (go version | cut --delimiter=' ' -f 3 | cut --characters='3-6' ) - end - - [ -z "$go_version" ] - and return - - __bobthefish_start_segment $color_virtualgo - echo -ns $go_glyph $go_version ' ' -end - function __bobthefish_prompt_rubies -S -d 'Display current Ruby information' [ "$theme_display_ruby" = 'no' ] and return @@ -863,6 +847,88 @@ function __bobthefish_prompt_rubies -S -d 'Display current Ruby information' echo -ns $ruby_glyph $ruby_version ' ' end +function __bobthefish_prompt_golang -S -d 'Display current Go information' + [ "$theme_display_go" = 'no' ] + and return + + set -l go_version + if type -fq asdf + set -l asdf_golang_version (asdf current golang 2>/dev/null) + or set -l asdf_golang_version "na" + + set -l asdf_go_sdk_version (asdf current go-sdk 2>/dev/null) + or set -l asdf_go_sdk_version "na" + + set -l _asdf_plugin + set -l asdf_go_version + set -l asdf_provenance + if [ "$asdf_golang_version" != "na" ] + echo "$asdf_golang_version" | read _asdf_plugin asdf_go_version asdf_provenance + else if [ "$asdf_go_sdk_version" != "na" ] + echo "$asdf_go_sdk_version" | read _asdf_plugin asdf_go_version asdf_provenance + end + + [ (string trim -- "$asdf_provenance") = "$HOME/.tool-versions" ] + and return + + set go_version $asdf_go_version + end + + set -l no_go_installed 0 + # no version from asdf, check go.mod file + if [ -z "$go_version" ] + set -l cwd (pwd) + set -l dir (pwd) + set -l gomod_file + set -l gomod_version + set -l _gomod + + set -l found_gomod 0 + + # find the closest go.mod + while not test "$dir" = "/" + set gomod_file "$dir/go.mod" + + if test -f "$gomod_file" + set found_gomod 1 + cat "$gomod_file" | grep "^go\ " | read _gomod gomod_version + break + end + + cd $dir/.. + set dir (pwd) + end + cd $cwd + + if test "$found_gomod" -eq "1" + # found go.mod file, but no version inside + if [ -z (string trim -- "$gomod_version") ] + # is there a version of go we can ask for the version? + if type -fq go + set gomod_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) + end + end + end + + set go_version $gomod_version + end + + if ! type -fq go + set no_go_installed 1 + end + + [ -z "$go_version" ] + and return + + __bobthefish_start_segment $color_virtualgo + echo -ns $go_glyph + if test "$no_go_installed" -eq "1" + # we got a version of go from a go.mod file, but no version of go is installed! + __bobthefish_start_segment $color_rvm + end + echo -ns $go_version ' ' +end + function __bobthefish_virtualenv_python_version -S -d 'Get current Python version' switch (python --version 2>&1 | tr '\n' ' ') case 'Python 2*PyPy*' From 4b3197d1b07062eb7c6f10c568619b704cad109e Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 11:41:50 -0700 Subject: [PATCH 12/52] Sort out the logic a bit more --- functions/fish_prompt.fish | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 0a8fda2..5769ef0 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -875,14 +875,14 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' end set -l no_go_installed 0 + set -l gomod_version "0" + # no version from asdf, check go.mod file if [ -z "$go_version" ] set -l cwd (pwd) set -l dir (pwd) set -l gomod_file - set -l gomod_version set -l _gomod - set -l found_gomod 0 # find the closest go.mod @@ -890,7 +890,6 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' set gomod_file "$dir/go.mod" if test -f "$gomod_file" - set found_gomod 1 cat "$gomod_file" | grep "^go\ " | read _gomod gomod_version break end @@ -900,30 +899,28 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' end cd $cwd - if test "$found_gomod" -eq "1" - # found go.mod file, but no version inside - if [ -z (string trim -- "$gomod_version") ] - # is there a version of go we can ask for the version? - if type -fq go - set gomod_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) - end - end - end - set go_version $gomod_version end + set -l actual_go_version "0" if ! type -fq go set no_go_installed 1 + else + set actual_go_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) end [ -z "$go_version" ] and return + set -l high_enough_version 0 + if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort + set high_enough_version 1 + end + __bobthefish_start_segment $color_virtualgo echo -ns $go_glyph - if test "$no_go_installed" -eq "1" - # we got a version of go from a go.mod file, but no version of go is installed! + if test "$high_enough_version" -eq "0" + # the version of go __bobthefish_start_segment $color_rvm end echo -ns $go_version ' ' From 1663a155f8013e5bed0b596e237b9fff23a7060a Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 11:54:52 -0700 Subject: [PATCH 13/52] More logic fixing --- functions/fish_prompt.fish | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 5769ef0..7602b4c 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -868,40 +868,40 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' echo "$asdf_go_sdk_version" | read _asdf_plugin asdf_go_version asdf_provenance end - [ (string trim -- "$asdf_provenance") = "$HOME/.tool-versions" ] - and return - set go_version $asdf_go_version end + + set -l cwd (pwd) + set -l dir (pwd) + set -l found_gomod 0 set -l no_go_installed 0 set -l gomod_version "0" - - # no version from asdf, check go.mod file - if [ -z "$go_version" ] - set -l cwd (pwd) - set -l dir (pwd) - set -l gomod_file - set -l _gomod - set -l found_gomod 0 - - # find the closest go.mod - while not test "$dir" = "/" - set gomod_file "$dir/go.mod" - - if test -f "$gomod_file" - cat "$gomod_file" | grep "^go\ " | read _gomod gomod_version - break - end + set -l gomod_file - cd $dir/.. - set dir (pwd) + # find the closest go.mod + while not test "$dir" = "/" + set gomod_file "$dir/go.mod" + + if test -f "$gomod_file" + set found_gomod 1 + cat "$gomod_file" | grep "^go\ " | read _gomod gomod_version + break end - cd $cwd + cd $dir/.. + set dir (pwd) + end + cd $cwd + + if [ -z "$go_version" ] set go_version $gomod_version end + if test "$found_gomod" -eq "0" + return + end + set -l actual_go_version "0" if ! type -fq go set no_go_installed 1 From 64a6f8ee18fd6202b7a7bbc30a461ee711dc2bd2 Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 12:21:52 -0700 Subject: [PATCH 14/52] More logic cleanup/fixing --- functions/fish_prompt.fish | 60 +++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 7602b4c..481b9a5 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -36,6 +36,8 @@ # set -g theme_display_nix no # set -g theme_display_ruby no # set -g theme_display_go no +# set -g theme_display_go_show_wrong_version yes +# set -g theme_display_go_actual diff # set -g theme_display_user ssh # set -g theme_display_hostname ssh # set -g theme_display_sudo_user yes @@ -854,14 +856,8 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' set -l go_version if type -fq asdf set -l asdf_golang_version (asdf current golang 2>/dev/null) - or set -l asdf_golang_version "na" - set -l asdf_go_sdk_version (asdf current go-sdk 2>/dev/null) - or set -l asdf_go_sdk_version "na" - set -l _asdf_plugin - set -l asdf_go_version - set -l asdf_provenance if [ "$asdf_golang_version" != "na" ] echo "$asdf_golang_version" | read _asdf_plugin asdf_go_version asdf_provenance else if [ "$asdf_go_sdk_version" != "na" ] @@ -875,7 +871,6 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' set -l cwd (pwd) set -l dir (pwd) set -l found_gomod 0 - set -l no_go_installed 0 set -l gomod_version "0" set -l gomod_file @@ -894,36 +889,53 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' end cd $cwd - if [ -z "$go_version" ] - set go_version $gomod_version - end - + # no go.mod, not in a go project, don't display the prompt if test "$found_gomod" -eq "0" return - end + end - set -l actual_go_version "0" + # check if there's a Go executable + set -l no_go_installed 0 + set -l actual_go_version 0 if ! type -fq go set no_go_installed 1 else set actual_go_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) end - [ -z "$go_version" ] - and return - set -l high_enough_version 0 - if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort - set high_enough_version 1 - end + if test "$no_go_installed" -eq "0" + if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort + set high_enough_version 1 + end + end __bobthefish_start_segment $color_virtualgo echo -ns $go_glyph - if test "$high_enough_version" -eq "0" - # the version of go - __bobthefish_start_segment $color_rvm - end - echo -ns $go_version ' ' + + # do we show the version in red if it's not the right version? + if [ "$theme_display_go_show_wrong_version" = "yes" ] + # yes we do, so check if the version is high enough + if test "$high_enough_version" -eq "0" + # the version of go isn't high enough + __bobthefish_start_segment $color_rvm + end + end + + if [ "$theme_display_go_actual" = "yes" ] + echo -ns "$actual_go_version" + else + echo -ns "$gomod_version" ' ' + if [ "$theme_display_go_actual" = "diff" ] + if [ "$gomod_version" != "$actual_go_version" ] + if [ "$actual_go_version" = "0" ] + echo -ns "(NA)" + else + echo -ns "($actual_go_version)" + end + end + end + end end function __bobthefish_virtualenv_python_version -S -d 'Get current Python version' From 20eb30bf4f1d0d5154107efd03533e0e3c763cae Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 12:26:05 -0700 Subject: [PATCH 15/52] Removing some un-needed code --- functions/fish_prompt.fish | 39 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 481b9a5..1bfe471 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -853,21 +853,6 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' [ "$theme_display_go" = 'no' ] and return - set -l go_version - if type -fq asdf - set -l asdf_golang_version (asdf current golang 2>/dev/null) - set -l asdf_go_sdk_version (asdf current go-sdk 2>/dev/null) - - if [ "$asdf_golang_version" != "na" ] - echo "$asdf_golang_version" | read _asdf_plugin asdf_go_version asdf_provenance - else if [ "$asdf_go_sdk_version" != "na" ] - echo "$asdf_go_sdk_version" | read _asdf_plugin asdf_go_version asdf_provenance - end - - set go_version $asdf_go_version - end - - set -l cwd (pwd) set -l dir (pwd) set -l found_gomod 0 @@ -895,18 +880,18 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' end # check if there's a Go executable - set -l no_go_installed 0 - set -l actual_go_version 0 - if ! type -fq go - set no_go_installed 1 + set -l no_go_installed "0" + set -l actual_go_version "0" + if type -fq go + set actual_go_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) else - set actual_go_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) + set no_go_installed "1" end - set -l high_enough_version 0 - if test "$no_go_installed" -eq "0" + set -l high_enough_version "0" + if [ "$no_go_installed" = "0" ] if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort - set high_enough_version 1 + set high_enough_version "1" end end @@ -916,14 +901,18 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' # do we show the version in red if it's not the right version? if [ "$theme_display_go_show_wrong_version" = "yes" ] # yes we do, so check if the version is high enough - if test "$high_enough_version" -eq "0" + if [ "$high_enough_version" = "0" ] # the version of go isn't high enough __bobthefish_start_segment $color_rvm end end if [ "$theme_display_go_actual" = "yes" ] - echo -ns "$actual_go_version" + if [ "$actual_go_version" = "0" ] + echo -ns "(NA)" + else + echo -ns "($actual_go_version)" + end else echo -ns "$gomod_version" ' ' if [ "$theme_display_go_actual" = "diff" ] From 69e58a2f6883b82b5fdd53b0b5f649be30f3bceb Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 12:40:13 -0700 Subject: [PATCH 16/52] Better greping --- functions/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 1bfe471..75e3911 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -865,7 +865,7 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' if test -f "$gomod_file" set found_gomod 1 - cat "$gomod_file" | grep "^go\ " | read _gomod gomod_version + grep "^go\ " "$gomod_file" | read __ gomod_version break end From 27f900076e1eb435541f538e7ac65dec4a97049e Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 12:40:18 -0700 Subject: [PATCH 17/52] Some prompt cleanup --- functions/fish_prompt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 75e3911..d8aa618 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -909,9 +909,9 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' if [ "$theme_display_go_actual" = "yes" ] if [ "$actual_go_version" = "0" ] - echo -ns "(NA)" + echo -ns "NA" else - echo -ns "($actual_go_version)" + echo -ns "$actual_go_version" end else echo -ns "$gomod_version" ' ' From fffbde266fb65e9cc8718d1550193fcb6217538e Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 12:41:49 -0700 Subject: [PATCH 18/52] Better "find directory", copied from hg code --- functions/fish_prompt.fish | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index d8aa618..61d7ee5 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -853,26 +853,21 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' [ "$theme_display_go" = 'no' ] and return - set -l cwd (pwd) - set -l dir (pwd) + + set -l dir $real_pwd set -l found_gomod 0 set -l gomod_version "0" set -l gomod_file # find the closest go.mod - while not test "$dir" = "/" - set gomod_file "$dir/go.mod" - - if test -f "$gomod_file" - set found_gomod 1 + while not [ -z "$d" ] + if [ -e $d/go.mod ] grep "^go\ " "$gomod_file" | read __ gomod_version - break end - cd $dir/.. - set dir (pwd) + [ "$d" = "/" ] + and return end - cd $cwd # no go.mod, not in a go project, don't display the prompt if test "$found_gomod" -eq "0" From 92a2e467344712c8207250203b8b3eb66d5e9677 Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 12:48:58 -0700 Subject: [PATCH 19/52] Update loop for finding go.mod Also had to move `set -l real_pwd (__bobthefish_pwd)` above the prompts so that `$real_pwd` is available inside the prompt function --- functions/fish_prompt.fish | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 61d7ee5..36138ff 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -852,17 +852,14 @@ end function __bobthefish_prompt_golang -S -d 'Display current Go information' [ "$theme_display_go" = 'no' ] and return - - - set -l dir $real_pwd - set -l found_gomod 0 - set -l gomod_version "0" - set -l gomod_file # find the closest go.mod + set -l gomod_version "0" + set -l d $real_pwd while not [ -z "$d" ] if [ -e $d/go.mod ] - grep "^go\ " "$gomod_file" | read __ gomod_version + grep "^go\ " "$d/go.mod" | read __ gomod_version + break end [ "$d" = "/" ] @@ -870,7 +867,7 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' end # no go.mod, not in a go project, don't display the prompt - if test "$found_gomod" -eq "0" + if [ "$gomod_version" = "0" ] return end @@ -1229,6 +1226,8 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' # Start each line with a blank slate set -l __bobthefish_current_bg + + set -l real_pwd (__bobthefish_pwd) # Status flags and input mode __bobthefish_prompt_status $last_status @@ -1253,7 +1252,6 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' __bobthefish_prompt_virtualgo __bobthefish_prompt_node - set -l real_pwd (__bobthefish_pwd) # VCS set -l git_root_dir (__bobthefish_git_project_dir $real_pwd) From bb9c3f194609e6120c99ca0515a54f3b254f19d9 Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 12:58:52 -0700 Subject: [PATCH 20/52] Ensure we go up a directory each iteration Whoops --- functions/fish_prompt.fish | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 36138ff..4b5eb9f 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -864,6 +864,8 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' [ "$d" = "/" ] and return + + set d (__bobthefish_dirname $d) end # no go.mod, not in a go project, don't display the prompt From d25d03ab4a37fa4be54a272b4443956620b15330 Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Fri, 17 Jun 2022 13:01:51 -0700 Subject: [PATCH 21/52] Better color setting for prompt --- functions/fish_prompt.fish | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 4b5eb9f..04f2a07 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -887,19 +887,21 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort set high_enough_version "1" end - end + end - __bobthefish_start_segment $color_virtualgo - echo -ns $go_glyph - # do we show the version in red if it's not the right version? if [ "$theme_display_go_show_wrong_version" = "yes" ] # yes we do, so check if the version is high enough if [ "$high_enough_version" = "0" ] # the version of go isn't high enough __bobthefish_start_segment $color_rvm + else + __bobthefish_start_segment $color_virtualgo end + else + __bobthefish_start_segment $color_virtualgo end + echo -ns $go_glyph if [ "$theme_display_go_actual" = "yes" ] if [ "$actual_go_version" = "0" ] From 4828218af53bd0706d7edf11eadd4bb357b5728c Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Sat, 18 Jun 2022 14:08:52 -0700 Subject: [PATCH 22/52] Simplifying the prompt --- functions/fish_prompt.fish | 59 +++++++++++++------------------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 04f2a07..9c17c01 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -36,8 +36,6 @@ # set -g theme_display_nix no # set -g theme_display_ruby no # set -g theme_display_go no -# set -g theme_display_go_show_wrong_version yes -# set -g theme_display_go_actual diff # set -g theme_display_user ssh # set -g theme_display_hostname ssh # set -g theme_display_sudo_user yes @@ -849,7 +847,8 @@ function __bobthefish_prompt_rubies -S -d 'Display current Ruby information' echo -ns $ruby_glyph $ruby_version ' ' end -function __bobthefish_prompt_golang -S -d 'Display current Go information' +function __bobthefish_prompt_golang -S -a real_pwd -d 'Display current Go information' + # setting is 'no', don't display the prompt [ "$theme_display_go" = 'no' ] and return @@ -876,49 +875,31 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information' # check if there's a Go executable set -l no_go_installed "0" set -l actual_go_version "0" - if type -fq go - set actual_go_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) - else - set no_go_installed "1" - end - set -l high_enough_version "0" - if [ "$no_go_installed" = "0" ] + if type -fq go + set actual_go_version (go version | string match -r 'go version go(\\d+\\.\\d+)' -g) if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort set high_enough_version "1" end - end - - # do we show the version in red if it's not the right version? - if [ "$theme_display_go_show_wrong_version" = "yes" ] - # yes we do, so check if the version is high enough - if [ "$high_enough_version" = "0" ] - # the version of go isn't high enough - __bobthefish_start_segment $color_rvm - else - __bobthefish_start_segment $color_virtualgo - end else + set no_go_installed "1" + end + + if [ "$high_enough_version" = "1" ] __bobthefish_start_segment $color_virtualgo + else + __bobthefish_start_segment $color_rvm end - echo -ns $go_glyph - if [ "$theme_display_go_actual" = "yes" ] - if [ "$actual_go_version" = "0" ] - echo -ns "NA" - else - echo -ns "$actual_go_version" - end - else - echo -ns "$gomod_version" ' ' - if [ "$theme_display_go_actual" = "diff" ] - if [ "$gomod_version" != "$actual_go_version" ] - if [ "$actual_go_version" = "0" ] - echo -ns "(NA)" - else - echo -ns "($actual_go_version)" - end - end + echo -ns $go_glyph + echo -ns "$gomod_version " + + # showing the prompt -- but plain ( for 'yes' ) or verbose? + if [ "$theme_display_go" = "verbose" ] + if [ "$actual_go_version" != "0" ] + # show the prompt with the required version AND the currently available + # version; same color rules as above + echo -ns " ($actual_go_version)" end end end @@ -1251,7 +1232,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' __bobthefish_prompt_nix __bobthefish_prompt_desk __bobthefish_prompt_rubies - __bobthefish_prompt_golang + __bobthefish_prompt_golang $real_pwd __bobthefish_prompt_virtualfish __bobthefish_prompt_virtualgo __bobthefish_prompt_node From 2dcfcab653ae69ae95ab57217fe64c97ae05d8de Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Mon, 1 Aug 2022 21:41:04 -0600 Subject: [PATCH 23/52] Fix invalid range in node segment Fixes #326 --- functions/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 331bc5b..898046e 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -897,7 +897,7 @@ end function __bobthefish_prompt_find_file_up -S -d 'Find file(s), going up the parent directories' set -l dir "$argv[1]" - set -l files $argv[2..] + set -l files $argv[2..-1] if test -z "$dir" or test -z "$files" From 96584de3df905bf0b8faae6a61d892fd9f581822 Mon Sep 17 00:00:00 2001 From: Hans van Luttikhuizen-Ross Date: Mon, 12 Sep 2022 11:09:09 +0200 Subject: [PATCH 24/52] Add color scheme using JetBrains' Darcula's colors --- functions/__bobthefish_colors.fish | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index b8b454f..a20520f 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -579,6 +579,48 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_virtualgo $base09 $colorfg --bold set -x color_desk $base09 $colorfg --bold + case 'darcula' + # light medium dark darkest + # ------ ------ ------ ------ + set -l grey 808080 616161 595959 424242 + set -l red FF4050 F0524F B82421 772E2C + set -l green 4FC414 5C962C 458500 39511F + set -l yellow E5BF00 A68A0D A87B00 5C4F17 + set -l blue 1FB0FF 3993D4 1778BD 245980 + set -l white F9F9F4 B7C3D0 + + set -x color_initial_segment_exit $white[2] $red[3] --bold + set -x color_initial_segment_private $white[2] $grey[4] + set -x color_initial_segment_su $white[2] $green[3] --bold + set -x color_initial_segment_jobs $white[2] $blue[3] --bold + + set -x color_path $grey[4] $white[2] + set -x color_path_basename $grey[4] $white[1] --bold + set -x color_path_nowrite $grey[4] $red[2] + set -x color_path_nowrite_basename $grey[4] $red[1] --bold + + set -x color_repo $green[3] $white[4] + set -x color_repo_work_tree $grey[4] $grey[4] --bold + set -x color_repo_dirty $red[3] $grey[4] + set -x color_repo_staged $yellow[3] $grey[4] + + set -x color_vi_mode_default $grey[4] $yellow[2] --bold + set -x color_vi_mode_insert $green[2] $grey[4] --bold + set -x color_vi_mode_visual $yellow[2] $grey[4] --bold + + set -x color_vagrant $blue[2] $green[1] --bold + set -x color_k8s $green[2] $grey[4] --bold + set -x color_aws_vault $blue[2] $grey[4] --bold + set -x color_aws_vault_expired $blue[2] $red[1] --bold + set -x color_username $grey[4] $blue[2] --bold + set -x color_hostname $grey[4] $blue[1] + set -x color_rvm $red[2] $grey[4] --bold + set -x color_node $green[3] $white[2] --bold + set -x color_virtualfish $blue[2] $grey[4] --bold + set -x color_virtualgo $blue[2] $grey[4] --bold + set -x color_desk $blue[2] $grey[4] --bold + set -x color_nix $blue[2] $grey[4] --bold + case '*' # default dark theme # light medium dark # ------ ------ ------ From 9588b3fe495d6ed97a302c02a4f9abbf7e1129e3 Mon Sep 17 00:00:00 2001 From: David Vallner Date: Fri, 30 Sep 2022 17:03:48 +0200 Subject: [PATCH 25/52] Support using Windows git under WSL Linux Git is unusably slow when accessing repos in the Windows filesystem when using WSL; using Windows Git fixes this issue but it breaks the prompt since Windows Git returns Windows paths. This converts the path to the equivalent POSIX path which restores the prompt under this setup; it should just return the original path when passed a POSIX path, and do nothing on non-WSL systems. --- functions/fish_prompt.fish | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 898046e..d0b46e6 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -157,6 +157,8 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p [ -z "$git_toplevel" ] and return + + command -q wslpath; and set -l git_toplevel (command wslpath $git_toplevel) # If there are no symlinks, just use git toplevel switch $real_pwd/ From 9ff7cd3f3c1445830895ca3b02a741a0e8692a5e Mon Sep 17 00:00:00 2001 From: Sean Patrick Hagen Date: Wed, 12 Oct 2022 14:05:37 -0700 Subject: [PATCH 26/52] Remove backslash to remove grep warning New in grep 3.8 apparently is this warning: `grep: warning: stray \ before white space`. Explanation: https://github.com/koalaman/shellcheck/issues/2573 --- functions/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 9c17c01..7e1161a 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -857,7 +857,7 @@ function __bobthefish_prompt_golang -S -a real_pwd -d 'Display current Go inform set -l d $real_pwd while not [ -z "$d" ] if [ -e $d/go.mod ] - grep "^go\ " "$d/go.mod" | read __ gomod_version + grep "^go " "$d/go.mod" | read __ gomod_version break end From 06ebe3b9af9af2e30f104b0956e255ca42ed5cab Mon Sep 17 00:00:00 2001 From: "Taylor \"Nekroze\" Lawson" Date: Thu, 16 Mar 2023 03:12:26 +1000 Subject: [PATCH 27/52] Hide k8s context or namespace when they are 'default' (#338) --- functions/fish_prompt.fish | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 898046e..21058ea 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -641,8 +641,10 @@ function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context' and [ -z $namespace -o "$namespace" = 'default' ] and return - set -l segment $k8s_glyph ' ' $context - [ -n "$namespace" ] + set -l segment $k8s_glyph ' ' + [ "$context" != 'default' ] + and set segment $segment $context + [ "$namespace" != 'default' ] and set segment $segment ':' $namespace __bobthefish_start_segment $color_k8s From 76cac812064fa749ffc258a20398c6f6250860c5 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sun, 26 Mar 2023 10:22:17 -0400 Subject: [PATCH 28/52] Don't overwrite $hostname Fixes #339 --- functions/fish_title.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fish_title.fish b/functions/fish_title.fish index 67f34d2..3a97daf 100644 --- a/functions/fish_title.fish +++ b/functions/fish_title.fish @@ -8,8 +8,8 @@ function __bobthefish_title_user -S -d 'Display actual user if different from $d if [ "$theme_title_display_user" = 'yes' ] if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ] set -l IFS . - uname -n | read -l hostname __ - echo -ns (whoami) '@' $hostname ' ' + uname -n | read -l host __ + echo -ns (whoami) '@' $host ' ' end end end From ed896b65c3ddbdf2929c38719adfb940b0d9b90d Mon Sep 17 00:00:00 2001 From: "Taylor \"Nekroze\" Lawson" Date: Mon, 8 May 2023 12:42:24 +1000 Subject: [PATCH 29/52] Fix error when k8s context defined but namespace isn't (#343) Fixed simple mistake of not double qouting namespace so when empty -z consumed -o as its input. --- functions/fish_prompt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 21058ea..4651743 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -637,8 +637,8 @@ function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context' [ "$theme_display_k8s_namespace" = 'yes' ] and set -l namespace (__bobthefish_k8s_namespace) - [ -z $context -o "$context" = 'default' ] - and [ -z $namespace -o "$namespace" = 'default' ] + [ -z "$context" -o "$context" = 'default' ] + and [ -z "$namespace" -o "$namespace" = 'default' ] and return set -l segment $k8s_glyph ' ' From c2c47dc964a257131b3df2a127c2631b4760f3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramon=20R=C3=BCttimann?= Date: Fri, 16 Jun 2023 09:40:21 +0200 Subject: [PATCH 30/52] Fix pwd calculation for git worktrees A refactor changed this block from a `set git_dir $PWD` to `set git_dir $real_pwd`, but as `real_pwd` is a "static" variable and not dynamically computed, this breaks within the `pushd` / `popd` flow. Instead of using `$real_pwd`, we need to compute the *current* directory by calling `__bobthefish_pwd` again. Fixes #249. --- functions/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 4651743..1ec90fd 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -185,7 +185,7 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p or return pushd $git_dir - set git_dir $real_pwd + set git_dir (__bobthefish_pwd) popd switch $real_pwd/ From 05c0765c4ec4c8fee7e2d485587e033b9e4e4543 Mon Sep 17 00:00:00 2001 From: Sergey Slipchenko Date: Mon, 18 Dec 2023 20:09:53 +0400 Subject: [PATCH 31/52] Use `status current-command` for title Why: 1. `$_` is marked as deprecated https://fishshell.com/docs/current/language.html#envvar-_ 2. `$_` contains wrong process name in cases like this one: ```fish sleep 1000 # `sleep` is the process, now press Ctrl-Z to suspend fg # unsuspend it, now `fg` is shown as the process ``` `status current-command` will show `sleep` instead, which makes more sense. --- functions/fish_title.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_title.fish b/functions/fish_title.fish index 3a97daf..c9f40ce 100644 --- a/functions/fish_title.fish +++ b/functions/fish_title.fish @@ -18,7 +18,7 @@ function fish_title __bobthefish_title_user if [ "$theme_title_display_process" = 'yes' ] - echo $_ + status current-command [ "$theme_title_display_path" != 'no' ] and echo ' ' From 11eef9f3fd74dfd0c82e85326cdecd91e584e025 Mon Sep 17 00:00:00 2001 From: Clover <39840298+SmollClover@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:06:21 +0100 Subject: [PATCH 32/52] Add Catppuccin Latte color scheme --- functions/__bobthefish_colors.fish | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index b8b454f..fd70de0 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -579,6 +579,66 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_virtualgo $base09 $colorfg --bold set -x color_desk $base09 $colorfg --bold + case 'catppuccin-latte' + set -l rosewater dc8a78 + set -l flamingo dd7878 + set -l pink ea76cb + set -l mauve 8839ef + set -l red d20f39 + set -l maroon e64553 + set -l peach fe640b + set -l yellow df8e1d + set -l green 40a02b + set -l teal 179299 + set -l sky 04a5e5 + set -l sapphire 209fb5 + set -l blue 1e66f5 + set -l lavender 7287fd + set -l text 4c4f69 + set -l subtext1 5c5f77 + set -l subtext0 6c6f85 + set -l overlay2 7c7f93 + set -l overlay1 8c8fa1 + set -l overlay0 9ca0b0 + set -l surface2 acb0be + set -l surface1 bcc0cc + set -l surface0 ccd0da + set -l base eff1f5 + set -l mantle e6e9ef + set -l crust dce0e8 + + set -x color_initial_segment_exit $surface2 $red --bold + set -x color_initial_segment_private $surface2 $flamingo + set -x color_initial_segment_su $surface2 $green --bold + set -x color_initial_segment_jobs $surface2 $peach --bold + + set -x color_path $surface0 $text + set -x color_path_basename $surface0 $text --bold + set -x color_path_nowrite $surface0 $mauve + set -x color_path_nowrite_basename $surface0 $mauve --bold + + set -x color_repo $green $mantle + set -x color_repo_work_tree $surface2 $mantle --bold + set -x color_repo_dirty $red $mantle + set -x color_repo_staged $yellow $mantle + + set -x color_vi_mode_default $sky $mantle --bold + set -x color_vi_mode_insert $green $mantle --bold + set -x color_vi_mode_visual $mauve $mantle --bold + + set -x color_vagrant $surface2 $text --bold + set -x color_k8s $surface2 $text --bold + set -x color_aws_vault $yellow $mantle --bold + set -x color_aws_vault_expired $red $mantle --bold + set -x color_username $surface2 $yellow --bold + set -x color_hostname $surface2 $yellow + set -x color_rvm $red $mantle --bold + set -x color_node $green $mantle --bold + set -x color_virtualfish $peach $mantle --bold + set -x color_virtualgo $sky $mantle --bold + set -x color_desk $peach $mantle --bold + set -x color_nix $sky $mantle --bold + case '*' # default dark theme # light medium dark # ------ ------ ------ From dbba0c90a695c04b2339802b6c6dbb7753d35f00 Mon Sep 17 00:00:00 2001 From: Clover <39840298+SmollClover@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:11:55 +0100 Subject: [PATCH 33/52] Add Catppuccin Frappe color scheme --- functions/__bobthefish_colors.fish | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index fd70de0..0e6170f 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -639,6 +639,66 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_desk $peach $mantle --bold set -x color_nix $sky $mantle --bold + case 'catppuccin-frappe' + set -l rosewater f2d5cf + set -l flamingo eebebe + set -l pink f4b8e4 + set -l mauve ca9ee6 + set -l red e78284 + set -l maroon ea999c + set -l peach ef9f76 + set -l yellow e5c890 + set -l green a6d189 + set -l teal 81c8be + set -l sky 99d1db + set -l sapphire 85c1dc + set -l blue 8caaee + set -l lavender babbf1 + set -l text c6d0f5 + set -l subtext1 b5bfe2 + set -l subtext0 a5adce + set -l overlay2 949cbb + set -l overlay1 838ba7 + set -l overlay0 737994 + set -l surface2 626880 + set -l surface1 51576d + set -l surface0 414559 + set -l base 303446 + set -l mantle 292c3c + set -l crust 232634 + + set -x color_initial_segment_exit $surface2 $red --bold + set -x color_initial_segment_private $surface2 $flamingo + set -x color_initial_segment_su $surface2 $green --bold + set -x color_initial_segment_jobs $surface2 $peach --bold + + set -x color_path $surface0 $text + set -x color_path_basename $surface0 $text --bold + set -x color_path_nowrite $surface0 $mauve + set -x color_path_nowrite_basename $surface0 $mauve --bold + + set -x color_repo $green $mantle + set -x color_repo_work_tree $surface2 $mantle --bold + set -x color_repo_dirty $red $mantle + set -x color_repo_staged $yellow $mantle + + set -x color_vi_mode_default $sky $mantle --bold + set -x color_vi_mode_insert $green $mantle --bold + set -x color_vi_mode_visual $mauve $mantle --bold + + set -x color_vagrant $surface2 $text --bold + set -x color_k8s $surface2 $text --bold + set -x color_aws_vault $yellow $mantle --bold + set -x color_aws_vault_expired $red $mantle --bold + set -x color_username $surface2 $yellow --bold + set -x color_hostname $surface2 $yellow + set -x color_rvm $red $mantle --bold + set -x color_node $green $mantle --bold + set -x color_virtualfish $peach $mantle --bold + set -x color_virtualgo $sky $mantle --bold + set -x color_desk $peach $mantle --bold + set -x color_nix $sky $mantle --bold + case '*' # default dark theme # light medium dark # ------ ------ ------ From ce7e20f61dd4d16f593a53016a5dc93d86700404 Mon Sep 17 00:00:00 2001 From: Clover <39840298+SmollClover@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:12:25 +0100 Subject: [PATCH 34/52] Add Catppuccin Macchiato color scheme --- functions/__bobthefish_colors.fish | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index 0e6170f..4e073e5 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -699,6 +699,66 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_desk $peach $mantle --bold set -x color_nix $sky $mantle --bold + case 'catppuccin-macchiato' + set -l rosewater f4dbd6 + set -l flamingo f0c6c6 + set -l pink f5bde6 + set -l mauve c6a0f6 + set -l red ed8796 + set -l maroon ee99a0 + set -l peach f5a97f + set -l yellow eed49f + set -l green a6da95 + set -l teal 8bd5ca + set -l sky 91d7e3 + set -l sapphire 7dc4e4 + set -l blue 8aadf4 + set -l lavender b7bdf8 + set -l text cad3f5 + set -l subtext1 b8c0e0 + set -l subtext0 a5adcb + set -l overlay2 939ab7 + set -l overlay1 8087a2 + set -l overlay0 6e738d + set -l surface2 5b6078 + set -l surface1 494d64 + set -l surface0 363a4f + set -l base 24273a + set -l mantle 1e2030 + set -l crust 181926 + + set -x color_initial_segment_exit $surface2 $red --bold + set -x color_initial_segment_private $surface2 $flamingo + set -x color_initial_segment_su $surface2 $green --bold + set -x color_initial_segment_jobs $surface2 $peach --bold + + set -x color_path $surface0 $text + set -x color_path_basename $surface0 $text --bold + set -x color_path_nowrite $surface0 $mauve + set -x color_path_nowrite_basename $surface0 $mauve --bold + + set -x color_repo $green $mantle + set -x color_repo_work_tree $surface2 $mantle --bold + set -x color_repo_dirty $red $mantle + set -x color_repo_staged $yellow $mantle + + set -x color_vi_mode_default $sky $mantle --bold + set -x color_vi_mode_insert $green $mantle --bold + set -x color_vi_mode_visual $mauve $mantle --bold + + set -x color_vagrant $surface2 $text --bold + set -x color_k8s $surface2 $text --bold + set -x color_aws_vault $yellow $mantle --bold + set -x color_aws_vault_expired $red $mantle --bold + set -x color_username $surface2 $yellow --bold + set -x color_hostname $surface2 $yellow + set -x color_rvm $red $mantle --bold + set -x color_node $green $mantle --bold + set -x color_virtualfish $peach $mantle --bold + set -x color_virtualgo $sky $mantle --bold + set -x color_desk $peach $mantle --bold + set -x color_nix $sky $mantle --bold + case '*' # default dark theme # light medium dark # ------ ------ ------ From ba0e0dfbdcf82f853f2976f8c167c0ab2ef8eb2f Mon Sep 17 00:00:00 2001 From: Clover <39840298+SmollClover@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:12:57 +0100 Subject: [PATCH 35/52] Add Catppuccin Mocha color scheme --- functions/__bobthefish_colors.fish | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index 4e073e5..13fc400 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -759,6 +759,66 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_desk $peach $mantle --bold set -x color_nix $sky $mantle --bold + case 'catppuccin-mocha' + set -l rosewater f5e0dc + set -l flamingo f2cdcd + set -l pink f5c2e7 + set -l mauve cba6f7 + set -l red f38ba8 + set -l maroon eba0ac + set -l peach fab387 + set -l yellow f9e2af + set -l green a6e3a1 + set -l teal 94e2d5 + set -l sky 89dceb + set -l sapphire 74c7ec + set -l blue 89b4fa + set -l lavender b4befe + set -l text cdd6f4 + set -l subtext1 bac2de + set -l subtext0 a6adc8 + set -l overlay2 9399b2 + set -l overlay1 7f849c + set -l overlay0 6c7086 + set -l surface2 585b70 + set -l surface1 45475a + set -l surface0 313244 + set -l base 1e1e2e + set -l mantle 181825 + set -l crust 11111b + + set -x color_initial_segment_exit $surface2 $red --bold + set -x color_initial_segment_private $surface2 $flamingo + set -x color_initial_segment_su $surface2 $green --bold + set -x color_initial_segment_jobs $surface2 $peach --bold + + set -x color_path $surface0 $text + set -x color_path_basename $surface0 $text --bold + set -x color_path_nowrite $surface0 $mauve + set -x color_path_nowrite_basename $surface0 $mauve --bold + + set -x color_repo $green $mantle + set -x color_repo_work_tree $surface2 $mantle --bold + set -x color_repo_dirty $red $mantle + set -x color_repo_staged $yellow $mantle + + set -x color_vi_mode_default $sky $mantle --bold + set -x color_vi_mode_insert $green $mantle --bold + set -x color_vi_mode_visual $mauve $mantle --bold + + set -x color_vagrant $surface2 $text --bold + set -x color_k8s $surface2 $text --bold + set -x color_aws_vault $yellow $mantle --bold + set -x color_aws_vault_expired $red $mantle --bold + set -x color_username $surface2 $yellow --bold + set -x color_hostname $surface2 $yellow + set -x color_rvm $red $mantle --bold + set -x color_node $green $mantle --bold + set -x color_virtualfish $peach $mantle --bold + set -x color_virtualgo $sky $mantle --bold + set -x color_desk $peach $mantle --bold + set -x color_nix $sky $mantle --bold + case '*' # default dark theme # light medium dark # ------ ------ ------ From f3803bb20cc90aa9daec0cbfcdf273ac8955087f Mon Sep 17 00:00:00 2001 From: Clover <39840298+SmollClover@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:16:20 +0100 Subject: [PATCH 36/52] Add README entry for Catppuccin color schemes --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ddd26f1..ef46610 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,7 @@ one of the following options to change the prompt colors. - `gruvbox`. An adaptation of gruvbox. - `dracula`. An adaptation of dracula. - `nord`. An adaptation of nord. +- `catpuccin-latte`, `catpuccin-frappe`, `catpuccin-macchiato`, `catpuccin-mocha`. Adaptations of the Cattpuccin themes. Some of these may not look right if your terminal does not support 24 bit color, in which case you can try one of the `terminal` schemes (below). However, if From 077e425d527d6472a1de9a283e31393d04ac7439 Mon Sep 17 00:00:00 2001 From: Clover <39840298+SmollClover@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:44:54 +0100 Subject: [PATCH 37/52] Add Catppuccin variants to bobthefish_display_colors --- functions/bobthefish_display_colors.fish | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/bobthefish_display_colors.fish b/functions/bobthefish_display_colors.fish index 9719b27..c9f25a6 100644 --- a/functions/bobthefish_display_colors.fish +++ b/functions/bobthefish_display_colors.fish @@ -5,6 +5,8 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo base16 base16-light \ gruvbox zenburn \ dracula nord \ + catppuccin-latte catppuccin-frappe \ + catppuccin-macchiato catppuccin-mocha \ terminal terminal-dark-white \ terminal-light terminal-light-black \ terminal2 terminal2-dark-white \ From 7ff4d6a3b3f74b9cb686dc4b00643358cc4817de Mon Sep 17 00:00:00 2001 From: Maximilian Schambach Date: Fri, 9 Feb 2024 12:54:58 +0100 Subject: [PATCH 38/52] 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 39/52] 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 40/52] 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 From dc70af567ed67e459a1683bd50ae16dedf307cc9 Mon Sep 17 00:00:00 2001 From: Kristian Rekstad Date: Wed, 18 Oct 2023 10:43:03 +0200 Subject: [PATCH 41/52] Use the new AWS_CREDENTIAL_EXPIRATION env var for aws-vault Fixes #350 --- functions/fish_prompt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 1ec90fd..4929d56 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -660,13 +660,13 @@ function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile' [ "$theme_display_aws_vault_profile" = 'yes' ] or return - [ -n "$AWS_VAULT" -a -n "$AWS_SESSION_EXPIRATION" ] + [ -n "$AWS_VAULT" -a -n "$AWS_CREDENTIAL_EXPIRATION" ] or return set -l profile $AWS_VAULT set -l now (date --utc +%s) - set -l expiry (date -d "$AWS_SESSION_EXPIRATION" +%s) + set -l expiry (date -d "$AWS_CREDENTIAL_EXPIRATION" +%s) set -l diff_mins (math "floor(( $expiry - $now ) / 60)") set -l diff_time $diff_mins"m" From 25b9c582c968929a52072a171874b14a95f27d2e Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 15:20:50 -0500 Subject: [PATCH 42/52] Allow hiding project parent paths. Set `theme_show_project_parent` to `no` to suppress the parent directory and path entirely when inside a Git or Mercurial project. Fixes #358 --- README.md | 2 ++ functions/fish_prompt.fish | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ddc8121..ed1de9e 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ set -g default_user your_normal_user set -g theme_color_scheme dark set -g fish_prompt_pwd_dir_length 0 set -g theme_project_dir_length 1 +set -g theme_show_project_parent yes set -g theme_newline_cursor yes set -g theme_newline_prompt '$ ' ``` @@ -140,6 +141,7 @@ set -g theme_newline_prompt '$ ' - `theme_use_abbreviated_branch_name`. Set to `yes` to truncate git branch names in the prompt. - `fish_prompt_pwd_dir_length`. bobthefish respects the Fish `$fish_prompt_pwd_dir_length` setting to abbreviate the prompt path. Set to `0` to show the full path, `1` (default) to show only the first character of each parent directory name, or any other number to show up to that many characters. - `theme_project_dir_length`. The same as `$fish_prompt_pwd_dir_length`, but for the path relative to the current project root. Defaults to `0`; set to any other number to show an abbreviated path. +- `theme_show_project_parent`. Set to `no` to only show the project directory name, and not its parent path, when inside a project. - `theme_newline_cursor`. Use `yes` to have cursor start on a new line. By default the prompt is only one line. When working with long directories it may be preferrend to have cursor on the next line. Setting this to `clean` instead of `yes` suppresses the caret on the new line. - `theme_newline_prompt`. Use a custom prompt with newline cursor. By default this is the chevron right glyph or `>` when powerline fonts are disabled. diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index a55c9a6..9b987b1 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -51,6 +51,7 @@ # set -g theme_color_scheme dark # set -g fish_prompt_pwd_dir_length 0 # set -g theme_project_dir_length 1 +# set -g theme_show_project_parent no # set -g theme_newline_cursor yes # ============================== @@ -358,7 +359,7 @@ function __bobthefish_start_segment -S -d 'Start a prompt segment' set __bobthefish_current_bg $bg end -function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened form of a directory' +function __bobthefish_path_segment -S -a segment_dir -a path_type -d 'Display a shortened form of a directory' set -l segment_color $color_path set -l segment_basename_color $color_path_basename @@ -382,7 +383,9 @@ function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened for set directory (__bobthefish_basename "$segment_dir") end - echo -n $parent + [ "$theme_show_project_parent" != "no" -o "$path_type" != "project" ] + and echo -n $parent + set_color -b $segment_basename_color echo -ns $directory ' ' end @@ -1057,7 +1060,7 @@ function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -d 'Display the ac set flag_colors $color_repo_dirty end - __bobthefish_path_segment $hg_root_dir + __bobthefish_path_segment $hg_root_dir project __bobthefish_start_segment $flag_colors echo -ns $hg_glyph ' ' @@ -1117,7 +1120,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the set flag_colors $color_repo_staged end - __bobthefish_path_segment $git_root_dir + __bobthefish_path_segment $git_root_dir project __bobthefish_start_segment $flag_colors echo -ns (__bobthefish_git_branch) $flags ' ' @@ -1199,7 +1202,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the end function __bobthefish_prompt_dir -S -a real_pwd -d 'Display a shortened form of the current directory' - __bobthefish_path_segment "$real_pwd" + __bobthefish_path_segment "$real_pwd" pwd end @@ -1225,7 +1228,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' # Start each line with a blank slate set -l __bobthefish_current_bg - + set -l real_pwd (__bobthefish_pwd) # Status flags and input mode From 1a74ffd598c1f1fd894d34b0440e10c51be0441b Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 15:55:21 -0500 Subject: [PATCH 43/52] Update config path examples. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed1de9e..a06a258 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` or `.conf/omf/init.fish`: +You can override some of the following default options in your fish config (e.g. `~/.config/fish/config.fish`, `~/.config/omf/init.fish`, or a script in `~/.config/fish/conf.d/`): ```fish set -g theme_display_git no From 2b060736b342f3b60dccabe913253acb203c58d1 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 17:57:16 -0500 Subject: [PATCH 44/52] Update configuration option documentation. - Clean up README formatting. - Move all configuration documentation from functions into the README. - Add missing documentation for a bunch of other options. Fixes #337 --- README.md | 302 ++++++++++++++++++++++--------- functions/fish_prompt.fish | 38 +--- functions/fish_right_prompt.fish | 4 +- functions/fish_title.fish | 6 +- 4 files changed, 221 insertions(+), 129 deletions(-) diff --git a/README.md b/README.md index a06a258..6897765 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ ![bobthefish][btf-screencast] -### Installation + +## Installation Be sure to have Oh My Fish installed. Then just: @@ -24,7 +25,8 @@ You will need a [Powerline-patched font][btf-patching] for this to work, unless This theme is based loosely on [agnoster][btf-agnoster]. -### Features + +## Features * A helpful, but not too distracting, greeting. * A subtle timestamp hanging out off to the right. @@ -35,7 +37,8 @@ This theme is based loosely on [agnoster][btf-agnoster]. * Visual indication that you can't write to the current directory. -### The Prompt + +## The Prompt * Status flags: * Previous command failed (**`!`**) @@ -63,89 +66,222 @@ This theme is based loosely on [agnoster][btf-agnoster]. * Abbreviated project-relative path -### Configuration + +## Configuration You can override some of the following default options in your fish config (e.g. `~/.config/fish/config.fish`, `~/.config/omf/init.fish`, or a script in `~/.config/fish/conf.d/`): ```fish -set -g theme_display_git no -set -g theme_display_git_dirty no -set -g theme_display_git_untracked no -set -g theme_display_git_ahead_verbose yes -set -g theme_display_git_dirty_verbose yes -set -g theme_display_git_stashed_verbose yes -set -g theme_display_git_default_branch yes -set -g theme_git_default_branches master main -set -g theme_git_worktree_support yes -set -g theme_use_abbreviated_branch_name yes -set -g theme_display_vagrant yes -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_display_nix no -set -g theme_display_ruby no -set -g theme_display_node yes -set -g theme_display_user ssh -set -g theme_display_hostname ssh -set -g theme_display_vi no -set -g theme_display_date no -set -g theme_display_cmd_duration yes -set -g theme_title_display_process yes -set -g theme_title_display_path no -set -g theme_title_display_user yes -set -g theme_title_use_abbreviated_path no -set -g theme_date_format "+%a %H:%M" -set -g theme_date_timezone America/Los_Angeles -set -g theme_avoid_ambiguous_glyphs yes -set -g theme_powerline_fonts no -set -g theme_nerd_fonts yes -set -g theme_show_exit_status yes -set -g theme_display_jobs_verbose yes -set -g default_user your_normal_user -set -g theme_color_scheme dark -set -g fish_prompt_pwd_dir_length 0 -set -g theme_project_dir_length 1 -set -g theme_show_project_parent yes -set -g theme_newline_cursor yes -set -g theme_newline_prompt '$ ' ``` -**Git options** - -- `theme_display_git_default_branch`. By default theme will hide/collapse the branch name in your prompt when you are using a Git _default branch_ i.e. historically `master` and often `main` now. Set to `yes` to stop these branches from being hidden/collapsed. -- `theme_git_default_branches`. The big cloud repos (GitHub, Bitbucket, GitLab et al.) are moving away from using `master` as the default branch name, and allow you to choose your own. As of version **2.28**, Git also supports custom default branch names via the `init.defaultBranch` config option. If our defaults of `master main` don't suit you, you can add/remove names in thist list i.e. `main trunk`. This ensures correct hiding/collapsing behaviour with custom default branch names (unless option above is activated). - -**Title options** - -- `theme_title_display_process`. By default theme doesn't show current process name in terminal title. If you want to show it, just set to `yes`. -- `theme_title_display_path`. Use `no` to hide current working directory from title. -- `theme_title_display_user`. Set to `yes` to show the current user in the tab title (unless you're the default user). -- `theme_title_use_abbreviated_path`. Default is `yes`. This means your home directory will be displayed as `~` and `/usr/local` as `/u/local`. Set it to `no` if you prefer full paths in title. - -**Prompt options** - -- `theme_display_ruby`. Use `no` to completely hide all information about Ruby version. By default Ruby version displayed if there is the difference from default settings. -- `theme_display_node`. If set to `always`, will display current NPM, NVM or FNM node version. If set to `yes`, will display the version if an `.nvmrc`, `.node-version` or `package.json` file is found in the parent directories. -- `theme_display_vagrant`. This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported. -- `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator. -- `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`). -- `theme_display_k8s_namespace`. This feature is disabled by default. Use `yes` to show the current kubernetes namespace. -- `theme_display_aws_vault_profile`. This feature is disabled by default. Use `yes` to show the currently executing [AWS Vault](https://github.com/99designs/aws-vault) profile. -- `theme_display_user`. If set to `yes`, display username always, if set to `ssh`, only when an SSH-Session is detected, if set to no, never. -- `theme_display_hostname`. Same behaviour as `theme_display_user`. -- `theme_display_sudo_user`. If set to `yes`, displays the sudo-username in a root shell. For example, when calling `sudo -s` and having this option set to `yes`, the username of the user, who called `sudo -s`, will be displayed. -- `theme_show_exit_status`. Set this option to `yes` to have the prompt show the last exit code if it was non_zero instead of just the exclamation mark. -- `theme_display_jobs_verbose`. If set to `yes` this option displays the number of currently running background jobs next to the percent sign. -- `theme_git_worktree_support`. If you do any git worktree shenanigans, setting this to `yes` will fix incorrect project-relative path display. If you don't do any git worktree shenanigans, leave it disabled. It's faster this way :) -- `theme_use_abbreviated_branch_name`. Set to `yes` to truncate git branch names in the prompt. -- `fish_prompt_pwd_dir_length`. bobthefish respects the Fish `$fish_prompt_pwd_dir_length` setting to abbreviate the prompt path. Set to `0` to show the full path, `1` (default) to show only the first character of each parent directory name, or any other number to show up to that many characters. -- `theme_project_dir_length`. The same as `$fish_prompt_pwd_dir_length`, but for the path relative to the current project root. Defaults to `0`; set to any other number to show an abbreviated path. -- `theme_show_project_parent`. Set to `no` to only show the project directory name, and not its parent path, when inside a project. -- `theme_newline_cursor`. Use `yes` to have cursor start on a new line. By default the prompt is only one line. When working with long directories it may be preferrend to have cursor on the next line. Setting this to `clean` instead of `yes` suppresses the caret on the new line. -- `theme_newline_prompt`. Use a custom prompt with newline cursor. By default this is the chevron right glyph or `>` when powerline fonts are disabled. - -**Color scheme options** + + +### Prompt options + +#### `set -g theme_display_vi yes` + +By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to always hide the indicator, or `yes` to always show the indicator. + +#### `set -g theme_show_exit_status yes` + +Use `yes` to show any non-zero exit code next to the exclamation mark. + +#### `set -g theme_display_jobs_verbose yes` + +Use `yes` to display the number of currently running background jobs next to the percent sign. + +#### `set -g theme_display_user yes` + +Set to `yes` to always display the username, to `ssh` to display only when an SSH session is active, or to `no` to never display the username. + +#### `set -g default_user your_normal_user` + +If a `default_user` is provided, the username will only be shown when it differs from the default. + +#### `set -g theme_display_sudo_user yes` + +If set to `yes`, displays the sudoer's username in a root shell. For example, when calling `sudo -s` with this option set to `yes`, the user who called `sudo -s` will be displayed. + +#### `set -g theme_display_hostname yes` + +Set to `yes` to always display the hostname, to `ssh` to display only when an SSH session is active, or to `no` to never display the hostname. + +#### `set -g fish_prompt_pwd_dir_length 1` + +Bobthefish respects the Fish `$fish_prompt_pwd_dir_length` setting to abbreviate the prompt path; set to `0` to show the full path, `1` (default) to show only the first character of each parent directory name, or any other number to show up to that many characters. + +#### `set -g theme_project_dir_length 1` + +The same as `$fish_prompt_pwd_dir_length`, but for the path relative to the current project root. Defaults to `0`; set to any other number to show an abbreviated path. + +#### `set -g theme_show_project_parent no` + +Use `no` to only show the project directory name, and not its parent path, when inside a project. + +#### `set -g theme_newline_cursor yes` + +Use `yes` to place the cursor on the next line, rather than the same line as the prompt. Setting this to `clean` instead of `yes` suppresses the caret on the new line. + +#### `set -g theme_newline_prompt "\$"` + +Use a custom prompt with newline cursor. By default this is the chevron right glyph or `>` when powerline fonts are disabled. + +#### `set -g theme_avoid_ambiguous_glyphs yes` + +You probably don't need this option, unless your terminal doesn't like Unicode. Setting to `yes` will avoid ambiguous-width characters in an attempt to + +#### `set -g theme_powerline_fonts no` + +Bobthefish really likes Powerline-enhanced fonts. If you can't make that work, set to `no` to use plaintext fallbacks. + +#### `set -g theme_nerd_fonts yes` + +Bobthefish likes Nerd Fonts even better! Use `yes` if you've got Nerd Font capable fonts. + +#### `set -g theme_color_scheme dark` + +See below for all the color scheming you can handle. + + + +### Virtual environments and version manager options + +#### `set -g theme_display_vagrant yes` + +This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported. + +#### `set -g theme_display_docker_machine no` + +Use `no` to disable the current Docker machine name. + +#### `set -g theme_display_ruby no` + +Use `no` to disable Ruby version information. By default, the Ruby version is displayed unless it's your system Ruby version. + +#### `set -g theme_display_virtualenv no` + +Use `no` to disable Python version information. By default, the Python version is shown when it's interesting, along with the Virtualenv or Conda environmenmt. + +#### `set -g theme_display_go verbose` + +Use `no` to disable the Go version information. Set to `verbose` to show both the required and current Go version. + +#### `set -g theme_display_node yes` + +This feature is disabled by default. Use `yes`, display the version if an `.nvmrc`, `.node-version` or `package.json` file is found in the parent path. Set to `always` to always display the current NPM, NVM or FNM node version. + +#### `set -g theme_display_nix no` + +Use `no` to disable Nix environment information. + +#### `set -g theme_display_k8s_context yes` + +This feature is disabled by default. Use `yes` to show the current Kubernetes context (`> kubectl config current-context`). + +#### `set -g theme_display_k8s_namespace yes` + +This feature is disabled by default. Use `yes` to show the current Kubernetes namespace. + +#### `set -g theme_display_aws_vault_profile yes` + +This feature is disabled by default. Use `yes` to show the currently executing [AWS Vault](https://github.com/99designs/aws-vault) profile. + + + +### Git (and other VCS) options + +#### `set -g theme_display_git no` + +Use `no` to disable Git integration. If you're doing this for performance reasons, try some of the options below before disabling it entirely! + +#### `set -g theme_display_git_dirty no` + +Use `no` to hide Git dirty state. Set the Git `bash.showDirtyState` option on a per-repository basis to disable it just for especially large repos. + +#### `set -g theme_display_git_dirty_verbose yes` + +This feature is disabled by default. Use `yes` to show more verbose dirty state information. + +#### `set -g theme_display_git_untracked no` + +Use `no` to hide Git untracked file state. Set the Git `bash.showUntrackedFiles` option on a per-repository basis to disable it just for especially large repos. + +#### `set -g theme_display_git_ahead_verbose yes` + +This feature is disabled by default. Use `yes` to show more verbose ahead/behind state information. + +#### `set -g theme_display_git_stashed_verbose yes` + +This feature is disabled by default. Use `yes` to show more verbose stashed state information. + +#### `set -g theme_display_git_default_branch yes` + +By default, Bobthefish hides the default branch name (e.g. `main` or `master`). Use `yes` to always show these branche names. + +#### `set -g theme_git_default_branches main trunk` + +By default, Bobthefish hides default branch names (e.g. `main` or `master`). To hide other branch names, you can set a custom default branch name via the `init.defaultBranch` Git config option, or override the list entirely. + +#### `set -g theme_use_abbreviated_branch_name yes` + +This feature is disabled by default. Use `yes` to truncate extremely long Git branch names. + +#### `set -g theme_git_worktree_support yes` + +If you do any Git worktree shenanigans, setting this to `yes` will fix incorrect project-relative paths. If you don't do any Git worktree shenanigans, leave it disabled. It's faster this way :) + +#### `set -g theme_display_hg yes` + +This feature is disabled by default. Use `yes` to enable Mercurial support in Bobthefish. If you don't use Mercurial, leave it disabled because it's ... not fast. + +#### `set -g theme_vcs_ignore_paths /some/path /some/other/path{foo,bar}` + +Ignore project paths for Git or Mercurial. Supports glob patterns. + + + +### Right prompt options + +The right prompt can be configured with the following options, or overridden entirely by supplying your own `fish_right_prompt` function. + +#### `set -g theme_display_date` + +Use `no` to disable the date in the right prompt. + +#### `set -g theme_date_format +%c` + +Customize date formatting. See `man date` for more information. + +#### `set -g theme_date_timezone America/Los_Angeles` + +Supply a TZ argument variable for date formatting. See `man date` for more information. + +#### `set -g theme_display_cmd_duration no` + +Use `no` to disable command duration in the right prompt. + + + +### Title options + +#### `set -g theme_title_display_process yes` + +This feature is disabled by default. Use `yes` to show current process name in the terminal title. + +#### `set -g theme_title_display_path no` + +Use `no` to hide current working directory from the terminal title. + +#### `set -g theme_title_display_user yes` + +Use `yes` to show the current user in the tab title (unless you're the default user). + +#### `set -g theme_title_use_abbreviated_path no` + +By default, directory names will be abbreviated in the terminal title, for example `~` instead of `$HOME` and `/u/local` instead of `/usr/local`. Set to `no` to always show full paths in the title. + + + +### Color schemes | ![dark][btf-dark] | ![light][btf-light] | | --------------------------- | --------------------------------------- | @@ -204,10 +340,8 @@ variables to set the colors of the prompt. See the "Colors" section of `fish_prompt.fish` for details. -**VCS options** -- `set -g theme_vcs_ignore_paths /some/path /some/other/path{foo,bar}`. Ignore project paths for Git or Mercurial. Supports glob patterns. -### Overrides +## Overrides You can disable the theme default greeting, vi mode prompt, right prompt, or title entirely — or override with your own — by adding custom functions to `~/.config/fish/functions`: diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 9b987b1..91a2c59 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -15,44 +15,8 @@ # # https://github.com/ryanoasis/nerd-fonts # -# You can override some default prompt options in your config.fish: +# See README.md for setup and configuration options. # -# set -g theme_display_git no -# set -g theme_display_git_dirty no -# set -g theme_display_git_untracked no -# set -g theme_display_git_ahead_verbose yes -# set -g theme_display_git_dirty_verbose yes -# set -g theme_display_git_stashed_verbose yes -# set -g theme_display_git_default_branch yes -# set -g theme_git_default_branches main trunk -# set -g theme_git_worktree_support yes -# set -g theme_display_vagrant yes -# set -g theme_display_docker_machine no -# set -g theme_display_k8s_context yes -# set -g theme_display_k8s_namespace no -# 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_go no -# set -g theme_display_user ssh -# set -g theme_display_hostname ssh -# set -g theme_display_sudo_user yes -# set -g theme_display_vi no -# set -g theme_display_node yes -# set -g theme_avoid_ambiguous_glyphs yes -# set -g theme_powerline_fonts no -# set -g theme_nerd_fonts yes -# set -g theme_show_exit_status yes -# set -g theme_display_jobs_verbose yes -# set -g default_user your_normal_user -# set -g theme_color_scheme dark -# set -g fish_prompt_pwd_dir_length 0 -# set -g theme_project_dir_length 1 -# set -g theme_show_project_parent no -# set -g theme_newline_cursor yes # ============================== # Helper methods diff --git a/functions/fish_right_prompt.fish b/functions/fish_right_prompt.fish index ef54772..45e14d6 100644 --- a/functions/fish_right_prompt.fish +++ b/functions/fish_right_prompt.fish @@ -1,6 +1,4 @@ -# You can override some default right prompt options in your config.fish: -# set -g theme_date_format "+%a %H:%M" -# set -g theme_date_timezone America/Los_Angeles +# See "Right prompt options" in README.md for configuration options function __bobthefish_cmd_duration -S -d 'Show command duration' [ "$theme_display_cmd_duration" = "no" ] diff --git a/functions/fish_title.fish b/functions/fish_title.fish index c9f40ce..91793c2 100644 --- a/functions/fish_title.fish +++ b/functions/fish_title.fish @@ -1,8 +1,4 @@ -# You can override some default title options in your config.fish: -# set -g theme_title_display_process no -# set -g theme_title_display_path no -# set -g theme_title_display_user yes -# set -g theme_title_use_abbreviated_path no +# See "Title options" in README.md for configuration options function __bobthefish_title_user -S -d 'Display actual user if different from $default_user' if [ "$theme_title_display_user" = 'yes' ] From 2e0f04b555c283c09f7997c555bdfc792c1db013 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 17:57:41 -0500 Subject: [PATCH 45/52] Support `init.defaultBranch` Git configuration option. --- functions/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 91a2c59..81ff6eb 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -47,7 +47,7 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish set -l branch (command git symbolic-ref HEAD 2>/dev/null | string replace -r '^refs/heads/' '') and begin [ -n "$theme_git_default_branches" ] - or set -l theme_git_default_branches master main + or set -l theme_git_default_branches master main (git config init.defaultBranch) [ "$theme_display_git_master_branch" != 'yes' -a "$theme_display_git_default_branch" != 'yes' ] and contains $branch $theme_git_default_branches From 4beb1bc3b47483021be27fd58d82362a8671e1b8 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 18:01:34 -0500 Subject: [PATCH 46/52] Update README config example. --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6897765..a6a2c31 100644 --- a/README.md +++ b/README.md @@ -69,11 +69,18 @@ This theme is based loosely on [agnoster][btf-agnoster]. ## Configuration -You can override some of the following default options in your fish config (e.g. `~/.config/fish/config.fish`, `~/.config/omf/init.fish`, or a script in `~/.config/fish/conf.d/`): +You can override theme defaults in a Fish config file (for example `~/.config/fish/conf.d/bobthefish.fish`): ```fish +set -g theme_nerd_fonts yes +set -g theme_color_scheme dark +set -g theme_display_user ssh +set -g default_user bobthecow ``` +See (many) more options below. + + ### Prompt options From bbb7cff04d6ef02c05bb1a9d4ed05f0eb6870829 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 18:21:39 -0500 Subject: [PATCH 47/52] Handle missing Python more gracefully. Fixes #335 --- functions/fish_prompt.fish | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 81ff6eb..e336245 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -887,6 +887,9 @@ function __bobthefish_virtualenv_python_version -S -d 'Get current Python versio end function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself) or conda environment." + type -fq python + or return + [ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" -a -z "$CONDA_DEFAULT_ENV" ] and return From 7216de5cac0216169c822597c9a3a75d32597406 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 19:27:31 -0500 Subject: [PATCH 48/52] Formatting and a comment. --- functions/fish_prompt.fish | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index abdd773..4cb3f76 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -123,8 +123,10 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p [ -z "$git_toplevel" ] and return - - command -q wslpath; and set -l git_toplevel (command wslpath $git_toplevel) + + # Support Git under WSL (see #336) + command -q wslpath + and set git_toplevel (command wslpath $git_toplevel) # If there are no symlinks, just use git toplevel switch $real_pwd/ From 8821f55849248a35ac0c15fae83a2c6f3d47b29f Mon Sep 17 00:00:00 2001 From: Evan Dean Date: Wed, 13 Nov 2019 17:21:40 -0500 Subject: [PATCH 49/52] Use repo root when looking for untracked files Currently, if you add a new file to a directory, then cd to a sibling directory, the untracked glyph will not appear. This is inconsistent with the behavior of the other git colors and flags, e.g. if you modify a file and cd into a sibling directory, the prompt will still be red and the dirty working directory glyph will still appear. This PR modifies the query used to find untracked files so it searches from the repo root instead of the current directory. --- functions/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 4cb3f76..74ea43a 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -1072,7 +1072,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the if [ "$theme_display_git_untracked" != 'no' ] set -l show_untracked (command git config --bool bash.showUntrackedFiles 2>/dev/null) if [ "$show_untracked" != 'false' ] - set new (command git ls-files --other --exclude-standard --directory --no-empty-directory 2>/dev/null) + set new (command git ls-files --other --exclude-standard --directory --no-empty-directory (git rev-parse --show-toplevel) 2>/dev/null) if [ "$new" ] set new "$git_untracked_glyph" end From 6e0ceba5dbe326a171abdaaac6159fb60a8fd049 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 19:36:55 -0500 Subject: [PATCH 50/52] Use $git_root_dir (to support WSL, worktrees, etc) for untracked files. --- functions/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 74ea43a..8fa489d 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -1072,7 +1072,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the if [ "$theme_display_git_untracked" != 'no' ] set -l show_untracked (command git config --bool bash.showUntrackedFiles 2>/dev/null) if [ "$show_untracked" != 'false' ] - set new (command git ls-files --other --exclude-standard --directory --no-empty-directory (git rev-parse --show-toplevel) 2>/dev/null) + set new (command git ls-files --other --exclude-standard --directory --no-empty-directory "$git_root_dir" 2>/dev/null) if [ "$new" ] set new "$git_untracked_glyph" end From 8669f50569f474afb547d1937d8bdf979877fbf3 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 19:53:54 -0500 Subject: [PATCH 51/52] Don't show detached branch ref if we've already shown a tag. --- functions/fish_prompt.fish | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 01958f4..ebb3983 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -66,8 +66,11 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish and return end - set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null) - echo "$detached_glyph $branch" + # If we've already shown a tag we don't need to show a detached branch + if [ -z "$tag" ] + set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null) + echo "$detached_glyph $branch" + end end function __bobthefish_hg_branch -S -d 'Get the current hg branch' From d277125050cfc66924fa6fc2910db87445539e67 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 9 Mar 2024 10:23:46 -0500 Subject: [PATCH 52/52] Update jellybeans --- functions/__bobthefish_colors.fish | 59 +++++++++++++----------- functions/bobthefish_display_colors.fish | 5 ++ 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index aeb1e4f..f1f6e83 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -648,33 +648,38 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -l light_green 99ad6a set -l dark_green 556633 - set -x color_initial_segment_exit $dark_red $white --bold - set -x color_initial_segment_su $red_orange $darker_grey --bold - set -x color_initial_segment_jobs $lilac $darker_grey --bold - - set -x color_path $dark_grey $light_grey - set -x color_path_basename $dark_grey $light_grey --bold - set -x color_path_nowrite $dark_grey $red_orange - set -x color_path_nowrite_basename $dark_grey $red_orange --bold - - set -x color_repo $light_green $darker_grey - set -x color_repo_work_tree $dark_grey $light_grey --bold - set -x color_repo_dirty $red $darker_grey - set -x color_repo_staged $pale_gold $darker_grey - - set -x color_vi_mode_default $bright_blue $darker_grey --bold - set -x color_vi_mode_insert $lilac $darker_grey --bold - set -x color_vi_mode_visual $cyan $darker_grey --bold - - set -x color_username $dark_grey $blue_grey --bold - set -x color_hostname $dark_grey $blue_grey - - set -x color_vagrant $lilac $darker_grey --bold - set -x color_k8s $pale_gold $darker_grey --bold - set -x color_rvm $pink $darker_grey --bold - set -x color_virtualfish $cyan $darker_grey --bold - set -x color_virtualgo $light_green $darker_grey --bold - set -x color_desk $light_grey $darker_grey --bold + set -x color_initial_segment_exit $dark_red $white --bold + set -x color_initial_segment_private $light_grey $dark_grey --bold + set -x color_initial_segment_su $red_orange $darker_grey --bold + set -x color_initial_segment_jobs $lilac $darker_grey --bold + + set -x color_path $dark_grey $light_grey + set -x color_path_basename $dark_grey $light_grey --bold + set -x color_path_nowrite $dark_grey $red_orange + set -x color_path_nowrite_basename $dark_grey $red_orange --bold + + set -x color_repo $light_green $darker_grey + set -x color_repo_work_tree $dark_grey $light_grey --bold + set -x color_repo_dirty $red $darker_grey + set -x color_repo_staged $pale_gold $darker_grey + + set -x color_vi_mode_default $bright_blue $darker_grey --bold + set -x color_vi_mode_insert $lilac $darker_grey --bold + set -x color_vi_mode_visual $cyan $darker_grey --bold + + set -x color_username $dark_grey $blue_grey --bold + set -x color_hostname $dark_grey $blue_grey + + set -x color_vagrant $lilac $darker_grey --bold + set -x color_k8s $pale_gold $darker_grey --bold + set -x color_aws_vault $deep_blue $pale_gold --bold + set -x color_aws_vault_expired $deep_blue $red --bold + set -x color_rvm $pink $darker_grey --bold + set -x color_nvm $bright_green $darker_grey --bold + set -x color_virtualfish $cyan $darker_grey --bold + set -x color_virtualgo $light_green $darker_grey --bold + set -x color_desk $light_grey $darker_grey --bold + set -x color_nix $bright_blue $darker_grey --bold case 'darcula' # light medium dark darkest diff --git a/functions/bobthefish_display_colors.fish b/functions/bobthefish_display_colors.fish index e84f649..4c6567c 100644 --- a/functions/bobthefish_display_colors.fish +++ b/functions/bobthefish_display_colors.fish @@ -5,6 +5,7 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo base16 base16-light \ gruvbox gruvbox-light zenburn \ dracula nord \ + jellybeans \ terminal terminal-dark-white \ terminal-light terminal-light-black \ terminal2 terminal2-dark-white \ @@ -129,6 +130,10 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo echo -ns $ruby_glyph rvm ' ' __bobthefish_finish_segments + __bobthefish_start_segment $color_nvm + echo -ns $ruby_glyph nvm ' ' + __bobthefish_finish_segments + __bobthefish_start_segment $color_virtualfish echo -ns $virtualenv_glyph virtualfish ' ' __bobthefish_finish_segments