Merge branch 'master' into color-scheme-catppuccin

This commit is contained in:
Justin Hileman
2024-03-09 10:25:49 -05:00
committed by GitHub
6 changed files with 473 additions and 137 deletions

View File

@@ -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
@@ -819,6 +861,108 @@ 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 '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_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
# ------ ------ ------ ------
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
# ------ ------ ------

View File

@@ -3,10 +3,11 @@ 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 \
catppuccin-latte catppuccin-frappe \
catppuccin-macchiato catppuccin-mocha \
jellybeans \
terminal terminal-dark-white \
terminal-light terminal-light-black \
terminal2 terminal2-dark-white \
@@ -131,6 +132,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

View File

@@ -15,42 +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_nix no
# set -g theme_display_ruby 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_newline_cursor yes
# ==============================
# Helper methods
@@ -78,10 +44,13 @@ 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" ]
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
@@ -97,12 +66,11 @@ 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"
# 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'
@@ -158,6 +126,10 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p
[ -z "$git_toplevel" ]
and return
# 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/
case $git_toplevel/\*
@@ -357,7 +329,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
@@ -381,7 +353,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
@@ -660,13 +634,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"
@@ -848,6 +822,63 @@ function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
echo -ns $ruby_glyph $ruby_version ' '
end
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
# 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 " "$d/go.mod" | read __ gomod_version
break
end
[ "$d" = "/" ]
and return
set d (__bobthefish_dirname $d)
end
# no go.mod, not in a go project, don't display the prompt
if [ "$gomod_version" = "0" ]
return
end
# check if there's a Go executable
set -l no_go_installed "0"
set -l actual_go_version "0"
set -l high_enough_version "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
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
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
function __bobthefish_virtualenv_python_version -S -d 'Get current Python version'
switch (python --version 2>&1 | tr '\n' ' ')
case 'Python 2*PyPy*'
@@ -862,14 +893,29 @@ 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
set -l version_glyph (__bobthefish_virtualenv_python_version)
set -l prompt_style 'default'
if [ "$version_glyph" ]
__bobthefish_start_segment $color_virtualfish
echo -ns $virtualenv_glyph $version_glyph ' '
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" ]
@@ -987,7 +1033,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 ' '
@@ -1028,7 +1074,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_root_dir" 2>/dev/null)
if [ "$new" ]
set new "$git_untracked_glyph"
end
@@ -1047,7 +1093,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 ' '
@@ -1129,7 +1175,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
@@ -1156,6 +1202,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
@@ -1174,11 +1222,11 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
__bobthefish_prompt_nix
__bobthefish_prompt_desk
__bobthefish_prompt_rubies
__bobthefish_prompt_golang $real_pwd
__bobthefish_prompt_virtualfish
__bobthefish_prompt_virtualgo
__bobthefish_prompt_node
set -l real_pwd (__bobthefish_pwd)
# VCS
set -l git_root_dir (__bobthefish_git_project_dir $real_pwd)

View File

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

View File

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