Merge branch 'master' into master

pull/227/head
Boky 4 years ago committed by GitHub
commit 147d028550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -82,6 +82,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_nix no
set -g theme_display_ruby no
set -g theme_display_nvm yes
set -g theme_display_user ssh
@ -94,6 +95,7 @@ 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
@ -121,6 +123,7 @@ set -g theme_newline_prompt '$ '
- `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_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.
@ -140,6 +143,7 @@ set -g theme_newline_prompt '$ '
| ![solarized][solarized] | ![solarized-light][solarized-light] |
| ![base16][base16] | ![base16-light][base16-light] |
| ![zenburn][zenburn] | ![terminal-dark][terminal-dark] |
| ![nord][nord] | |
You can use the function `bobthefish_display_colors` to preview the prompts in
any color scheme.
@ -156,6 +160,7 @@ one of the following options to change the prompt colors.
- `zenburn`. An adaptation of Zenburn.
- `gruvbox`. An adaptation of gruvbox.
- `dracula`. An adaptation of dracula.
- `nord`. An adaptation of nord.
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
@ -234,3 +239,4 @@ end
[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"

@ -1,9 +1,42 @@
# This is handled inside fish_mode_prompt (see `__bobthefish_prompt_vi`)
# Display the current binding mode... if it's vi or vi-like.
#
# If you want to override this with your own mode prompt, disable bobthefish's
# built-in mode prompt in your fish config:
# To always show the binding mode (regardless of current bindings):
# set -g theme_display_vi yes
#
# To never show:
# set -g theme_display_vi no
function fish_mode_prompt
function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator'
[ "$theme_display_vi" != 'no' ]
or return
[ "$fish_key_bindings" = 'fish_vi_key_bindings' \
-o "$fish_key_bindings" = 'hybrid_bindings' \
-o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \
-o "$theme_display_vi" = 'yes' ]
or return
__bobthefish_colors $theme_color_scheme
type -q bobthefish_colors
and bobthefish_colors
set_color normal # clear out anything bold or underline...
switch $fish_bind_mode
case default
set_color -b $color_vi_mode_default
echo -n ' N '
case insert
set_color -b $color_vi_mode_insert
echo -n ' I '
case replace_one replace-one
set_color -b $color_vi_mode_insert
echo -n ' R '
case visual
set_color -b $color_vi_mode_visual
echo -n ' V '
end
set_color normal
end

@ -28,8 +28,10 @@
# 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_hg yes
# set -g theme_display_virtualenv no
# set -g theme_display_nix no
# set -g theme_display_ruby no
# set -g theme_display_user ssh
# set -g theme_display_hostname ssh
@ -66,6 +68,13 @@ function __bobthefish_pwd -d 'Get a normalized $PWD'
or echo $PWD
end
# Note that for fish < 3.0 this falls back to unescaped, rather than trying to do something clever /shrug
# After we drop support for older fishies, we can inline this without the fallback.
function __bobthefish_escape_regex -a str -d 'A backwards-compatible `string escape --style=regex` implementation'
string escape --style=regex "$str" 2>/dev/null
or echo "$str"
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)
and begin
@ -102,7 +111,7 @@ function __bobthefish_pretty_parent -S -a child_dir -d 'Print a parent directory
# Replace $HOME with ~
set -l real_home ~
set -l parent_dir (string replace -r '^'"$real_home"'($|/)' '~$1' (__bobthefish_dirname $child_dir))
set -l parent_dir (string replace -r '^'(__bobthefish_escape_regex "$real_home")'($|/)' '~$1' (__bobthefish_dirname $child_dir))
# Must check whether `$parent_dir = /` if using native dirname
if [ -z "$parent_dir" ]
@ -230,7 +239,7 @@ function __bobthefish_project_pwd -S -a project_root_dir -a real_pwd -d 'Print t
set -q theme_project_dir_length
or set -l theme_project_dir_length 0
set -l project_dir (string replace -r '^'"$project_root_dir"'($|/)' '' $real_pwd)
set -l project_dir (string replace -r '^'(__bobthefish_escape_regex "$project_root_dir")'($|/)' '' $real_pwd)
if [ $theme_project_dir_length -eq 0 ]
echo -n $project_dir
@ -384,7 +393,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" ]
else if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ]
echo -ns '> '
else
echo -ns "$right_arrow_glyph "
@ -399,7 +408,7 @@ end
# ==============================
# Status and input mode segments
# Status segment
# ==============================
function __bobthefish_prompt_currentos -S -d 'Display current OS version'
@ -532,32 +541,6 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a no
end
end
function __bobthefish_prompt_vi -S -d 'Display vi mode'
[ "$theme_display_vi" != 'no' ]
or return
[ "$fish_key_bindings" = 'fish_vi_key_bindings' \
-o "$fish_key_bindings" = 'hybrid_bindings' \
-o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \
-o "$theme_display_vi" = 'yes' ]
or return
switch $fish_bind_mode
case default
__bobthefish_start_segment $color_vi_mode_default
echo -n 'N '
case insert
__bobthefish_start_segment $color_vi_mode_insert
echo -n 'I '
case replace_one replace-one
__bobthefish_start_segment $color_vi_mode_insert
echo -n 'R '
case visual
__bobthefish_start_segment $color_vi_mode_visual
echo -n 'V '
end
end
# ==============================
# Container and VM segments
@ -694,7 +677,12 @@ function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
set -l context (__bobthefish_k8s_context)
or return
set -l namespace (__bobthefish_k8s_namespace)
[ "$theme_display_k8s_namespace" = 'yes' ]
and set -l namespace (__bobthefish_k8s_namespace)
[ -z $context -o "$context" = 'default' ]
and [ -z $namespace -o "$namespace" = 'default' ]
and return
set -l segment $k8s_glyph " " $context
[ -n "$namespace" ]
@ -869,11 +857,13 @@ function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
else if type -q chruby # chruby is implemented as a function, so omitting the -f is intentional
set ruby_version $RUBY_VERSION
else if type -fq asdf
asdf current ruby 2>/dev/null | read -l asdf_ruby_version asdf_provenance
set -l asdf_current_ruby (asdf current ruby 2>/dev/null)
or return
echo "$asdf_current_ruby" | read -l asdf_ruby_version asdf_provenance
# If asdf changes their ruby version provenance format, update this to match
[ "$asdf_provenance" = "(set by $HOME/.tool-versions)" ]
[ (string trim -- "$asdf_provenance") = "(set by $HOME/.tool-versions)" ]
and return
set ruby_version $asdf_ruby_version
@ -949,6 +939,15 @@ function __bobthefish_prompt_nvm -S -d 'Display current node version through NVM
set_color normal
end
function __bobthefish_prompt_nix -S -d 'Display current nix environment'
[ "$theme_display_nix" = 'no' -o -z "$IN_NIX_SHELL" ]
and return
__bobthefish_start_segment $color_nix
echo -ns $nix_glyph $IN_NIX_SHELL ' '
set_color normal
end
# ==============================
# VCS segments
@ -1138,17 +1137,17 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
# Status flags and input mode
__bobthefish_prompt_currentos
__bobthefish_prompt_status $last_status
__bobthefish_prompt_vi
# User / hostname info
__bobthefish_prompt_user
# Containers and VMs
__bobthefish_prompt_vagrant
__bobthefish_prompt_docker
__bobthefish_prompt_k8s_context
# User / hostname info
__bobthefish_prompt_user
# Virtual environments
__bobthefish_prompt_nix
__bobthefish_prompt_desk
__bobthefish_prompt_rubies
__bobthefish_prompt_virtualfish

@ -1,5 +1,6 @@
# 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
function __bobthefish_cmd_duration -S -d 'Show command duration'
[ "$theme_display_cmd_duration" = "no" ]
@ -62,12 +63,12 @@ function __bobthefish_timestamp -S -d 'Show the current timestamp'
or set -l theme_date_format "+%c"
echo -n ' '
date $theme_date_format
env TZ="$theme_date_timezone" date $theme_date_format
end
function fish_right_prompt -d 'bobthefish is all about the right prompt'
set -l __bobthefish_left_arrow_glyph \uE0B3
if [ "$theme_powerline_fonts" = "no" ]
if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ]
set __bobthefish_left_arrow_glyph '<'
end

@ -36,7 +36,9 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
set -x color_currentos green $colorfg --bold
case 'terminal-light*'
set -x color_nix brblue $colorfg --bold
case 'terminal-light*'
set -l colorfg white
[ "$color_scheme" = 'terminal-light-black' ]; and set colorfg black
set -x color_initial_segment_exit black red --bold
@ -68,6 +70,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
set -x color_currentos green $colorfg --bold
set -x color_nix brblue $colorfg --bold
case 'terminal2' 'terminal2-dark*'
set -l colorfg black
@ -101,6 +104,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
set -x color_currentos green $colorfg --bold
set -x color_nix brblue $colorfg --bold
case 'terminal2-light*'
set -l colorfg white
@ -134,6 +138,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
set -x color_currentos green $colorfg --bold
set -x color_nix brblue $colorfg --bold
case 'zenburn'
set -l grey 333333 # a bit darker than normal zenburn grey
@ -173,6 +178,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $blue $grey --bold
set -x color_desk $blue $grey --bold
set -x color_currentos $green $white --bold
set -x color_nix $blue $grey --bold
case 'base16-light'
set -l base00 181818
@ -223,6 +229,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $base0D $colorfg --bold
set -x color_desk $base0D $colorfg --bold
set -x color_currentos $base0B $colorfg --bold
set -x color_nix $base0D $colorfg --bold
case 'base16' 'base16-dark'
set -l base00 181818
@ -273,6 +280,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $base0D $colorfg --bold
set -x color_desk $base0D $colorfg --bold
set -x color_currentos $base0B $colorfg --bold
set -x color_nix $base0D $colorfg --bold
case 'solarized-light'
set -l base03 002b36
@ -323,6 +331,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $cyan $colorfg --bold
set -x color_desk $cyan $colorfg --bold
set -x color_currentos $green $colorfg --bold
set -x color_nix $cyan $colorfg --bold
case 'solarized' 'solarized-dark'
set -l base03 002b36
@ -373,6 +382,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $cyan $colorfg --bold
set -x color_desk $cyan $colorfg --bold
set -x color_currentos $green $colorfg --bold
set -x color_nix $cyan $colorfg --bold
case 'light'
# light medium dark
@ -416,6 +426,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $blue[2] $grey[1] --bold
set -x color_desk $blue[2] $grey[1] --bold
set -x color_currentos $green $colorfg --bold
set -x color_nix $blue[2] $grey[1] --bold
case 'gruvbox'
# light medium dark darkest
@ -458,6 +469,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $blue[2] $fg[2] --bold
set -x color_desk $blue[2] $fg[2] --bold
set -x color_currentos $green $colorfg --bold
set -x color_nix $blue[2] $fg[2] --bold
case 'dracula' # https://draculatheme.com
set -l bg 282a36
@ -502,6 +514,56 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $cyan $bg --bold
set -x color_desk $comment $bg --bold
set -x color_currentos $green $bg --bold
set -x color_nix $cyan $bg --bold
case 'nord'
set -l base00 2E3440
set -l base01 3B4252
set -l base02 434C5E
set -l base03 4C566A
set -l base04 D8DEE9
set -l base05 E5E9F0
set -l base06 ECEFF4
set -l base07 8FBCBB
set -l base08 88C0D0
set -l base09 81A1C1
set -l base0A 5E81AC
set -l base0B BF616A
set -l base0C D08770
set -l base0D EBCB8B
set -l base0E A3BE8C
set -l base0F B48EAD
set -l colorfg $base00
set -x color_initial_segment_exit $base05 $base08 --bold
set -x color_initial_segment_su $base05 $base0B --bold
set -x color_initial_segment_jobs $base08 $base0D --bold
set -x color_path $base02 $base05
set -x color_path_basename $base02 $base06 --bold
set -x color_path_nowrite $base02 $base08
set -x color_path_nowrite_basename $base02 $base08 --bold
set -x color_repo $base0E $colorfg
set -x color_repo_work_tree $base02 $colorfg --bold
set -x color_repo_dirty $base0B $colorfg
set -x color_repo_staged $base0D $colorfg
set -x color_vi_mode_default $base08 $colorfg --bold
set -x color_vi_mode_insert $base06 $colorfg --bold
set -x color_vi_mode_visual $base07 $colorfg --bold
set -x color_vagrant $base02 $colorfg --bold
set -x color_k8s $base02 $colorfg --bold
set -x color_username $base02 $base0D --bold
set -x color_hostname $base02 $base0D
set -x color_rvm $base09 $colorfg --bold
set -x color_nvm $base09 $colorfg --bold
set -x color_virtualfish $base09 $colorfg --bold
set -x color_virtualgo $base09 $colorfg --bold
set -x color_desk $base09 $colorfg --bold
set -x color_currentos $base09 $colorfg --bold
case '*' # default dark theme
# light medium dark
@ -546,6 +608,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
set -x color_virtualgo $go_blue $black --bold
set -x color_desk $blue[2] $grey[1] --bold
set -x color_currentos $green $white --bold
set -x color_nix $blue[2] $grey[1] --bold
end
end
@ -571,6 +634,7 @@ function __bobthefish_user_color_scheme_deprecated
set -q __color_virtualfish; or set -l __color_virtualfish 005faf cccccc --bold
set -q __color_virtualgo; or set -l __color_virtualgo 005faf cccccc --bold
set -q __color_desk; or set -l __color_desk 005faf cccccc --bold
set -q __color_nix; or set -l __color_nix 005faf cccccc --bold
set_color black -b red --bold
echo "The 'user' color scheme is deprecated."
@ -607,6 +671,7 @@ function __bobthefish_user_color_scheme_deprecated
set -x color_virtualfish $__color_virtualfish
set -x color_virtualgo $__color_virtualgo
set -x color_desk $__color_desk
set -x color_nix $__color_nix
end"
echo

@ -21,6 +21,7 @@ function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish'
set -x ruby_glyph ''
set -x go_glyph ''
set -x nix_glyph ''
# Desk glyphs
set -x desk_glyph \u25F2
@ -79,6 +80,7 @@ function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish'
set detached_glyph \uF417
set tag_glyph \uF412
set nix_glyph \uF313 ' ' # nf-linux-nixos
set virtualenv_glyph \uE73C ' '
set ruby_glyph \uE791 ' '
set go_glyph \uE626 ' '

@ -23,8 +23,16 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo
__bobthefish_colors $color_scheme
case ''
[ -n "$theme_color_scheme" ]
and echo "$theme_color_scheme:"
if type -q bobthefish_colors
if [ -n "$theme_color_scheme" ]
echo "$theme_color_scheme (with bobthefish_colors overrides):"
else
echo 'custom (via bobthefish_colors):'
end
else if [ -n "$theme_color_scheme" ]
echo "$theme_color_scheme:"
end
__bobthefish_colors $theme_color_scheme
type -q bobthefish_colors
and bobthefish_colors

Loading…
Cancel
Save