Merge branch 'master' into screen

pull/264/head
Paulo Flabiano Smorigo 3 years ago
commit 1c1c2cfc42

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013-2014 Justin Hileman
Copyright (c) 2013-2021 Justin Hileman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,10 +1,10 @@
# bobthefish
`bobthefish` is a Powerline-style, Git-aware [fish][fish] theme optimized for awesome.
`bobthefish` is a Powerline-style, Git-aware [fish][btf-fish] theme optimized for awesome.
[![Oh My Fish](https://img.shields.io/badge/Framework-Oh_My_Fish-blue.svg?style=flat)](https://github.com/oh-my-fish/oh-my-fish) [![MIT License](https://img.shields.io/github/license/oh-my-fish/theme-bobthefish.svg?style=flat)](/LICENSE.md)
![bobthefish][screencast]
![bobthefish][btf-screencast]
### Installation
@ -13,15 +13,15 @@ Be sure to have Oh My Fish installed. Then just:
omf install bobthefish
You will need a [Powerline-patched font][patching] for this to work, unless you enable the compatibility fallback option:
You will need a [Powerline-patched font][btf-patching] for this to work, unless you enable the compatibility fallback option:
set -g theme_powerline_fonts no
[I recommend picking one of these][fonts]. For more advanced awesome, install a [nerd fonts patched font][nerd-fonts], and enable nerd fonts support:
[I recommend picking one of these][btf-fonts]. For more advanced awesome, install a [nerd fonts patched font][btf-nerd-fonts], and enable nerd fonts support:
set -g theme_nerd_fonts yes
This theme is based loosely on [agnoster][agnoster].
This theme is based loosely on [agnoster][btf-agnoster].
### Features
@ -47,7 +47,7 @@ This theme is based loosely on [agnoster][agnoster].
* Current RVM, rbenv or chruby (Ruby) version
* Current virtualenv (Python) version
* _If you use virtualenv, you will probably need to disable the default virtualenv prompt, since it doesn't play nice with fish: `set -x VIRTUAL_ENV_DISABLE_PROMPT 1`_
* Current NVM version (Nodejs) (inactive by default; see configurations in the next paragraph)
* Current NVM/FNM version (Nodejs) (inactive by default; see configurations in the next paragraph)
* Abbreviated parent directory
* Current directory, or Git or Mercurial project name
* Current project's repo branch (<img width="16" alt="branch-glyph" src="https://cloud.githubusercontent.com/assets/53660/8768360/53ee9b58-2e32-11e5-9977-cee0063936fa.png"> master) or detached head (`➦` d0dfd9b)
@ -74,7 +74,8 @@ 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_master_branch 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
@ -84,7 +85,7 @@ set -g theme_display_hg yes
set -g theme_display_virtualenv no
set -g theme_display_nix no
set -g theme_display_ruby no
set -g theme_display_nvm yes
set -g theme_display_node yes
set -g theme_display_user ssh
set -g theme_display_hostname ssh
set -g theme_display_vi no
@ -108,6 +109,10 @@ set -g theme_project_dir_length 1
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**
@ -119,11 +124,12 @@ 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_nvm`. If set to `yes`, will display current NVM node version.
- `theme_display_node`. If set to `yes`, will display current NVM or FNM node version.
- `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.
@ -138,12 +144,12 @@ set -g theme_newline_prompt '$ '
**Color scheme options**
| ![dark][dark] | ![light][light] |
| ----------------------- | ----------------------------------- |
| ![solarized][solarized] | ![solarized-light][solarized-light] |
| ![base16][base16] | ![base16-light][base16-light] |
| ![zenburn][zenburn] | ![terminal-dark][terminal-dark] |
| ![nord][nord] | |
| ![dark][btf-dark] | ![light][btf-light] |
| --------------------------- | --------------------------------------- |
| ![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] | |
You can use the function `bobthefish_display_colors` to preview the prompts in
any color scheme.
@ -224,19 +230,19 @@ end
```
[fish]: https://github.com/fish-shell/fish-shell
[screencast]: https://cloud.githubusercontent.com/assets/53660/18028510/f16f6b2c-6c35-11e6-8eb9-9f23ea3cce2e.gif
[patching]: https://powerline.readthedocs.org/en/master/installation.html#patched-fonts
[fonts]: https://github.com/Lokaltog/powerline-fonts
[nerd-fonts]: https://github.com/ryanoasis/nerd-fonts
[agnoster]: https://gist.github.com/agnoster/3712874
[dark]: https://cloud.githubusercontent.com/assets/53660/16141569/ee2bbe4a-3411-11e6-85dc-3d9b0226e833.png "dark"
[light]: https://cloud.githubusercontent.com/assets/53660/16141570/f106afc6-3411-11e6-877d-fc2a8f6d3175.png "light"
[solarized]: https://cloud.githubusercontent.com/assets/53660/16141572/f7724032-3411-11e6-8771-b43769e7afec.png "solarized"
[solarized-light]: https://cloud.githubusercontent.com/assets/53660/16141575/fbed8036-3411-11e6-92e9-90da6d45f94b.png "solarized-light"
[base16]: https://cloud.githubusercontent.com/assets/53660/16141577/0134763a-3412-11e6-9cca-6040d39c8fd4.png "base16"
[base16-light]: https://cloud.githubusercontent.com/assets/53660/16141579/02f7245e-3412-11e6-97c6-5f3cecffb73c.png "base16-light"
[zenburn]: https://cloud.githubusercontent.com/assets/53660/16141580/06229dd4-3412-11e6-84aa-a48de127b6da.png "zenburn"
[terminal-dark]: https://cloud.githubusercontent.com/assets/53660/16141583/0b3e8eea-3412-11e6-8068-617c5371f6ea.png "terminal-dark"
[nord]: https://user-images.githubusercontent.com/39213657/72811435-f64ca800-3c5f-11ea-8711-dcce8cfc50fb.png "nord"
[btf-fish]: https://github.com/fish-shell/fish-shell
[btf-screencast]: https://cloud.githubusercontent.com/assets/53660/18028510/f16f6b2c-6c35-11e6-8eb9-9f23ea3cce2e.gif
[btf-patching]: https://powerline.readthedocs.org/en/master/installation.html#patched-fonts
[btf-fonts]: https://github.com/Lokaltog/powerline-fonts
[btf-nerd-fonts]: https://github.com/ryanoasis/nerd-fonts
[btf-agnoster]: https://gist.github.com/agnoster/3712874
[btf-dark]: https://cloud.githubusercontent.com/assets/53660/16141569/ee2bbe4a-3411-11e6-85dc-3d9b0226e833.png "dark"
[btf-light]: https://cloud.githubusercontent.com/assets/53660/16141570/f106afc6-3411-11e6-877d-fc2a8f6d3175.png "light"
[btf-solarized]: https://cloud.githubusercontent.com/assets/53660/16141572/f7724032-3411-11e6-8771-b43769e7afec.png "solarized"
[btf-solarized-light]: https://cloud.githubusercontent.com/assets/53660/16141575/fbed8036-3411-11e6-92e9-90da6d45f94b.png "solarized-light"
[btf-base16]: https://cloud.githubusercontent.com/assets/53660/16141577/0134763a-3412-11e6-9cca-6040d39c8fd4.png "base16"
[btf-base16-light]: https://cloud.githubusercontent.com/assets/53660/16141579/02f7245e-3412-11e6-97c6-5f3cecffb73c.png "base16-light"
[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"

@ -28,11 +28,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_aws_vault blue $colorfg --bold
set -x color_aws_vault_expired blue red --bold
set -x color_username white black --bold
set -x color_hostname white black
set -x color_screen brgreen $colorfg --bold
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_node brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
@ -62,11 +64,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_aws_vault blue $colorfg --bold
set -x color_aws_vault_expired blue red --bold
set -x color_username black white --bold
set -x color_hostname black white
set -x color_screen brgreen $colorfg --bold
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_node brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
@ -96,11 +100,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_aws_vault blue $colorfg --bold
set -x color_aws_vault_expired blue red --bold
set -x color_username brgrey white --bold
set -x color_hostname brgrey white
set -x color_screen brgreen $colorfg --bold
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_node brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
@ -130,11 +136,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_aws_vault blue $colorfg --bold
set -x color_aws_vault_expired blue red --bold
set -x color_username grey black --bold
set -x color_hostname grey black
set -x color_screen brgreen $colorfg --bold
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_node brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
@ -170,11 +178,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $blue $green --bold
set -x color_k8s $green $white --bold
set -x color_aws_vault $blue $grey --bold
set -x color_aws_vault_expired $blue $red --bold
set -x color_username $grey $blue --bold
set -x color_hostname $grey $blue
set -x color_screen $green $grey --bold
set -x color_rvm $red $grey --bold
set -x color_nvm $green $white --bold
set -x color_node $green $white --bold
set -x color_virtualfish $blue $grey --bold
set -x color_virtualgo $blue $grey --bold
set -x color_desk $blue $grey --bold
@ -221,11 +231,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $base0C $colorfg --bold
set -x color_k8s $base06 $colorfg --bold
set -x color_aws_vault $base0D $colorfg --bold
set -x color_aws_vault_expired $base0D $base08 --bold
set -x color_username $base02 $base0D --bold
set -x color_hostname $base02 $base0D
set -x color_screen $base06 $colorfg --bold
set -x color_rvm $base08 $colorfg --bold
set -x color_nvm $base0B $colorfg --bold
set -x color_node $base0B $colorfg --bold
set -x color_virtualfish $base0D $colorfg --bold
set -x color_virtualgo $base0D $colorfg --bold
set -x color_desk $base0D $colorfg --bold
@ -272,11 +284,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $base0C $colorfg --bold
set -x color_k8s $base0B $colorfg --bold
set -x color_aws_vault $base0D $base0A --bold
set -x color_aws_vault_expired $base0D $base08 --bold
set -x color_username $base02 $base0D --bold
set -x color_hostname $base02 $base0D
set -x color_screen $base0B $colorfg --bold
set -x color_rvm $base08 $colorfg --bold
set -x color_nvm $base0B $colorfg --bold
set -x color_node $base0B $colorfg --bold
set -x color_virtualfish $base0D $colorfg --bold
set -x color_virtualgo $base0D $colorfg --bold
set -x color_desk $base0D $colorfg --bold
@ -323,11 +337,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $violet $colorfg --bold
set -x color_k8s $green $colorfg --bold
set -x color_aws_vault $violet $base3 --bold
set -x color_aws_vault_expired $violet $orange --bold
set -x color_username $base2 $blue --bold
set -x color_hostname $base2 $blue
set -x color_screen $green $colorfg --bold
set -x color_rvm $red $colorfg --bold
set -x color_nvm $green $colorfg --bold
set -x color_node $green $colorfg --bold
set -x color_virtualfish $cyan $colorfg --bold
set -x color_virtualgo $cyan $colorfg --bold
set -x color_desk $cyan $colorfg --bold
@ -374,11 +390,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $violet $colorfg --bold
set -x color_k8s $green $colorfg --bold
set -x color_aws_vault $violet $base3 --bold
set -x color_aws_vault_expired $violet $orange --bold
set -x color_username $base02 $blue --bold
set -x color_hostname $base02 $blue
set -x color_screen $green $colorfg --bold
set -x color_rvm $red $colorfg --bold
set -x color_nvm $green $colorfg --bold
set -x color_node $green $colorfg --bold
set -x color_virtualfish $cyan $colorfg --bold
set -x color_virtualgo $cyan $colorfg --bold
set -x color_desk $cyan $colorfg --bold
@ -418,11 +436,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $blue[1] $white --bold
set -x color_k8s $green[1] $colorfg --bold
set -x color_aws_vault $blue[3] $orange[1] --bold
set -x color_aws_vault_expired $blue[3] $red[3] --bold
set -x color_username $grey[1] $blue[3] --bold
set -x color_hostname $grey[1] $blue[3]
set -x color_screen $green[1] $colorfg --bold
set -x color_rvm $ruby_red $grey[1] --bold
set -x color_nvm $green $grey[1] --bold
set -x color_node $green $grey[1] --bold
set -x color_virtualfish $blue[2] $grey[1] --bold
set -x color_virtualgo $blue[2] $grey[1] --bold
set -x color_desk $blue[2] $grey[1] --bold
@ -461,11 +481,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $blue[2] $fg[2] --bold
set -x color_k8s $green[2] $fg[2] --bold
set -x color_aws_vault $blue[2] $yellow[1] --bold
set -x color_aws_vault_expired $blue[2] $red[1] --bold
set -x color_username $fg[3] $blue[2] --bold
set -x color_hostname $fg[3] $blue[2]
set -x color_screen $green[1] $fg[2] --bold
set -x color_rvm $red[2] $fg[2] --bold
set -x color_nvm $green[1] $fg[2] --bold
set -x color_node $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
@ -506,11 +528,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $pink $bg --bold
set -x color_k8s $green $fg --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
set -x color_hostname $selection $cyan
set -x color_screen $green $bg --bold
set -x color_rvm $red $bg --bold
set -x color_nvm $green $bg --bold
set -x color_node $green $bg --bold
set -x color_virtualfish $comment $bg --bold
set -x color_virtualgo $cyan $bg --bold
set -x color_desk $comment $bg --bold
@ -536,10 +560,10 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -l colorfg $base00
set -x color_initial_segment_exit $base05 $base08 --bold
set -x color_initial_segment_exit $base05 $base0B --bold
set -x color_initial_segment_private $base05 $base02
set -x color_initial_segment_su $base05 $base0B --bold
set -x color_initial_segment_jobs $base08 $base0D --bold
set -x color_initial_segment_su $base05 $base0E --bold
set -x color_initial_segment_jobs $base05 $base0C --bold
set -x color_path $base02 $base05
set -x color_path_basename $base02 $base06 --bold
@ -557,11 +581,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $base02 $colorfg --bold
set -x color_k8s $base02 $colorfg --bold
set -x color_aws_vault $base0A $base0D --bold
set -x color_aws_vault_expired $base0A $base0B --bold
set -x color_username $base02 $base0D --bold
set -x color_hostname $base02 $base0D
set -x color_screen $base02 $colorfg --bold
set -x color_rvm $base09 $colorfg --bold
set -x color_nvm $base09 $colorfg --bold
set -x color_node $base09 $colorfg --bold
set -x color_virtualfish $base09 $colorfg --bold
set -x color_virtualgo $base09 $colorfg --bold
set -x color_desk $base09 $colorfg --bold
@ -601,11 +627,13 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_vagrant $blue[1] $white --bold
set -x color_k8s $green[2] $white --bold
set -x color_aws_vault $blue[3] $orange[1] --bold
set -x color_aws_vault_expired $blue[3] $red[3] --bold
set -x color_username $grey[1] $blue[3] --bold
set -x color_hostname $grey[1] $blue[3]
set -x color_screen $green[1] $white --bold
set -x color_rvm $ruby_red $grey[1] --bold
set -x color_nvm $green[1] $white --bold
set -x color_node $green[1] $white --bold
set -x color_virtualfish $blue[2] $grey[1] --bold
set -x color_virtualgo $go_blue $black --bold
set -x color_desk $blue[2] $grey[1] --bold
@ -668,6 +696,8 @@ function __bobthefish_user_color_scheme_deprecated
set -x color_vi_mode_insert $__color_vi_mode_insert
set -x color_vi_mode_visual $__color_vi_mode_visual
set -x color_vagrant $__color_vagrant
set -x color_aws_vault $__color_aws_vault
set -x color_aws_vault_expired $__color_aws_vault_expired
set -x color_username $__color_username
set -x color_hostname $__color_hostname
set -x color_screen $__color_screen

@ -145,5 +145,13 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo
echo -ns $desk_glyph desk ' '
__bobthefish_finish_segments
__bobthefish_start_segment $color_aws_vault
echo -ns aws-vault ' (' active ') '
__bobthefish_finish_segments
__bobthefish_start_segment $color_aws_vault_expired
echo -ns aws-vault ' (' expired ') '
__bobthefish_finish_segments
echo -e "\n"
end

@ -23,12 +23,14 @@
# 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_master_branch 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_nix no
@ -39,7 +41,7 @@
# set -g theme_display_screen_verbose no
# set -g theme_display_sudo_user yes
# set -g theme_display_vi no
# set -g theme_display_nvm yes
# 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
@ -78,18 +80,22 @@ 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 ref (command git symbolic-ref HEAD 2>/dev/null)
set -l branch (command git symbolic-ref HEAD 2>/dev/null | string replace -r '^refs/heads/' '')
and begin
[ "$theme_display_git_master_branch" != 'yes' -a "$ref" = 'refs/heads/master' ]
[ -n "$theme_git_default_branches" ]
or set -l theme_git_default_branches master main
[ "$theme_display_git_master_branch" != 'yes' -a "$theme_display_git_default_branch" != 'yes' ]
and contains $branch $theme_git_default_branches
and echo $branch_glyph
and return
# truncate the middle of the branch name, but only if it's 25+ characters
set -l truncname $ref
set -l truncname $branch
[ "$theme_use_abbreviated_branch_name" = 'yes' ]
and set truncname (string replace -r '^(.{28}).{3,}(.{5})$' "\$1…\$2" $ref)
and set truncname (string replace -r '^(.{17}).{3,}(.{5})$' "\$1…\$2" $branch)
string replace -r '^refs/heads/' "$branch_glyph " $truncname
echo $branch_glyph $truncname
and return
end
@ -395,7 +401,7 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments'
if set -q theme_newline_prompt
echo -ens "$theme_newline_prompt"
else if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ]
else if [ "$theme_powerline_fonts" = 'no' -a "$theme_nerd_fonts" != 'yes' ]
echo -ns '> '
else
echo -ns "$right_arrow_glyph "
@ -637,12 +643,45 @@ 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
set -l segment $k8s_glyph ' ' $context
[ -n "$namespace" ]
and set segment $segment ":" $namespace
and set segment $segment ':' $namespace
__bobthefish_start_segment $color_k8s
echo -ns $segment " "
echo -ns $segment ' '
end
# ==============================
# Cloud Tools
# ==============================
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" ]
or return
set -l profile $AWS_VAULT
set -l now (date --utc +%s)
set -l expiry (date -d "$AWS_SESSION_EXPIRATION" +%s)
set -l diff_mins (math "floor(( $expiry - $now ) / 60)")
set -l diff_time $diff_mins"m"
[ $diff_mins -le 0 ]
and set -l diff_time '0m'
[ $diff_mins -ge 60 ]
and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m"
set -l segment $profile ' (' $diff_time ')'
set -l status_color $color_aws_vault
[ $diff_mins -le 0 ]
and set -l status_color $color_aws_vault_expired
__bobthefish_start_segment $status_color
echo -ns $segment ' '
end
@ -854,20 +893,37 @@ function __bobthefish_prompt_desk -S -d 'Display current desk environment'
and return
__bobthefish_start_segment $color_desk
echo -ns $desk_glyph ' ' (basename -a -s ".fish" "$DESK_ENV") ' '
echo -ns $desk_glyph ' ' (basename -a -s '.fish' "$DESK_ENV") ' '
set_color normal
end
function __bobthefish_prompt_nvm -S -d 'Display current node version through NVM'
[ "$theme_display_nvm" = 'yes' -a -n "$NVM_DIR" ]
function __bobthefish_prompt_node -S -d 'Display current node version'
[ "$theme_display_node" = 'yes' -o "$theme_display_nvm" = 'yes' ]
or return
set -l node_version (nvm current 2> /dev/null)
set -l node_manager
set -l node_manager_dir
if type -q nvm
set node_manager 'nvm'
set node_manager_dir $NVM_DIR
else if type -fq fnm
set node_manager 'fnm'
set node_manager_dir $FNM_DIR
end
[ -n "$node_manager_dir" ]
or return
set -l node_version ("$node_manager" current 2> /dev/null)
[ -z $node_version -o "$node_version" = 'none' -o "$node_version" = 'system' ]
and return
__bobthefish_start_segment $color_nvm
[ -n "$color_nvm" ]
and set -x color_node $color_nvm
__bobthefish_start_segment $color_node
echo -ns $node_glyph $node_version ' '
set_color normal
end
@ -891,7 +947,7 @@ function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -d 'Display the ac
set -l flags "$dirty"
[ "$flags" ]
and set flags ""
and set flags ''
set -l flag_colors $color_repo
if [ "$dirty" ]
@ -1067,8 +1123,8 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set -l last_status $status
# Use a simple prompt on dumb terminals.
if [ "$TERM" = "dumb" ]
echo "> "
if [ "$TERM" = 'dumb' ]
echo '> '
return
end
@ -1095,13 +1151,16 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
__bobthefish_prompt_docker
__bobthefish_prompt_k8s_context
# Cloud Tools
__bobthefish_prompt_aws_vault_profile
# Virtual environments
__bobthefish_prompt_nix
__bobthefish_prompt_desk
__bobthefish_prompt_rubies
__bobthefish_prompt_virtualfish
__bobthefish_prompt_virtualgo
__bobthefish_prompt_nvm
__bobthefish_prompt_node
set -l real_pwd (__bobthefish_pwd)

@ -63,7 +63,9 @@ function __bobthefish_timestamp -S -d 'Show the current timestamp'
or set -l theme_date_format "+%c"
echo -n ' '
env TZ="$theme_date_timezone" date $theme_date_format
set -q theme_date_timezone
and env TZ="$theme_date_timezone" date $theme_date_format
or date $theme_date_format
end
function fish_right_prompt -d 'bobthefish is all about the right prompt'
Loading…
Cancel
Save