Merge branch 'master' into screen

This commit is contained in:
Paulo Flabiano Smorigo
2021-09-10 10:35:36 -03:00
9 changed files with 174 additions and 69 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,10 @@
function fish_greeting -d "What's up, fish?"
set_color $fish_color_autosuggestion
uname -nmsr
# TODO: `command -q -s` only works on fish 2.5+, so hold off on that for now
command -s uptime >/dev/null
and command uptime
set_color normal
end

View File

@@ -0,0 +1,42 @@
# Display the current binding mode... if it's vi or vi-like.
#
# 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 -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

1188
functions/fish_prompt.fish Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
# 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" ]
and return
[ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]
and return
if [ "$CMD_DURATION" -lt 5000 ]
echo -ns $CMD_DURATION 'ms'
else if [ "$CMD_DURATION" -lt 60000 ]
__bobthefish_pretty_ms $CMD_DURATION s
else if [ "$CMD_DURATION" -lt 3600000 ]
set_color $fish_color_error
__bobthefish_pretty_ms $CMD_DURATION m
else
set_color $fish_color_error
__bobthefish_pretty_ms $CMD_DURATION h
end
set_color $fish_color_normal
set_color $fish_color_autosuggestion
[ "$theme_display_date" = "no" ]
or echo -ns ' ' $__bobthefish_left_arrow_glyph
end
function __bobthefish_pretty_ms -S -a ms -a interval -d 'Millisecond formatting for humans'
set -l interval_ms
set -l scale 1
switch $interval
case s
set interval_ms 1000
case m
set interval_ms 60000
case h
set interval_ms 3600000
set scale 2
end
switch $FISH_VERSION
case 2.0.\* 2.1.\* 2.2.\* 2.3.\*
# Fish 2.3 and lower doesn't know about the -s argument to math.
math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
case 2.\*
# Fish 2.x always returned a float when given the -s argument.
math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
case \*
math -s$scale "$ms/$interval_ms"
echo -ns $interval
end
end
function __bobthefish_timestamp -S -d 'Show the current timestamp'
[ "$theme_display_date" = "no" ]
and return
set -q theme_date_format
or set -l theme_date_format "+%c"
echo -n ' '
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'
set -l __bobthefish_left_arrow_glyph \uE0B3
if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ]
set __bobthefish_left_arrow_glyph '<'
end
set_color $fish_color_autosuggestion
__bobthefish_cmd_duration
__bobthefish_timestamp
set_color normal
end

34
functions/fish_title.fish Normal file
View File

@@ -0,0 +1,34 @@
# 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
function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
if [ "$theme_title_display_user" = 'yes' ]
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
set -l IFS .
hostname | read -l hostname __
echo -ns (whoami) '@' $hostname ' '
end
end
end
function fish_title
__bobthefish_title_user
if [ "$theme_title_display_process" = 'yes' ]
echo $_
[ "$theme_title_display_path" != 'no' ]
and echo ' '
end
if [ "$theme_title_display_path" != 'no' ]
if [ "$theme_title_use_abbreviated_path" = 'no' ]
echo $PWD
else
prompt_pwd
end
end
end