Run fish_indent

This commit is contained in:
Justin Hileman
2026-05-14 23:21:23 -04:00
parent c5efbe05ae
commit c45a1ec53b
8 changed files with 334 additions and 342 deletions

View File

@@ -1,3 +1,3 @@
function __bobthefish_display_colors -d 'Print example prompts using the current color scheme' function __bobthefish_display_colors -d 'Print example prompts using the current color scheme'
bobthefish_display_colors bobthefish_display_colors
end end

View File

@@ -1,104 +1,104 @@
function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish' function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish'
# Powerline glyphs # Powerline glyphs
set -x branch_glyph \uE0A0 set -x branch_glyph \uE0A0
set -x right_black_arrow_glyph \uE0B0 set -x right_black_arrow_glyph \uE0B0
set -x right_arrow_glyph \uE0B1 set -x right_arrow_glyph \uE0B1
set -x left_black_arrow_glyph \uE0B2 set -x left_black_arrow_glyph \uE0B2
set -x left_arrow_glyph \uE0B3 set -x left_arrow_glyph \uE0B3
# Additional glyphs # Additional glyphs
set -x detached_glyph \u27A6 set -x detached_glyph \u27A6
set -x tag_glyph \u2302 set -x tag_glyph \u2302
set -x nonzero_exit_glyph '! ' set -x nonzero_exit_glyph '! '
set -x private_glyph \uE0A2 ' ' set -x private_glyph \uE0A2 ' '
set -x superuser_glyph '$ ' set -x superuser_glyph '$ '
set -x bg_job_glyph '% ' set -x bg_job_glyph '% '
set -x hg_glyph \u263F set -x hg_glyph \u263F
# Python glyphs # Python glyphs
set -x superscript_glyph \u00B9 \u00B2 \u00B3 set -x superscript_glyph \u00B9 \u00B2 \u00B3
set -x virtualenv_glyph \u25F0 set -x virtualenv_glyph \u25F0
set -x pypy_glyph \u1D56 set -x pypy_glyph \u1D56
set -x ruby_glyph '' set -x ruby_glyph ''
set -x go_glyph '' set -x go_glyph ''
set -x nix_glyph '' set -x nix_glyph ''
# Desk glyphs # Desk glyphs
set -x desk_glyph \u25F2 set -x desk_glyph \u25F2
# Kubernetes glyphs # Kubernetes glyphs
set -x k8s_glyph \u2388 # '⎈' set -x k8s_glyph \u2388 # '⎈'
# Vagrant glyphs # Vagrant glyphs
set -x vagrant_running_glyph \u2191 # ↑ 'running' set -x vagrant_running_glyph \u2191 # ↑ 'running'
set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff' set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff'
set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted' set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted'
set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved' set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved'
set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping' set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping'
set -x vagrant_unknown_glyph '!' # strange cases set -x vagrant_unknown_glyph '!' # strange cases
# Git glyphs # Git glyphs
set -x git_dirty_glyph '*' set -x git_dirty_glyph '*'
set -x git_staged_glyph '~' set -x git_staged_glyph '~'
set -x git_stashed_glyph '$' set -x git_stashed_glyph '$'
set -x git_untracked_glyph '…' set -x git_untracked_glyph '…'
set -x git_ahead_glyph \u2191 # '↑' set -x git_ahead_glyph \u2191 # '↑'
set -x git_behind_glyph \u2193 # '↓' set -x git_behind_glyph \u2193 # '↓'
set -x git_plus_glyph '+' set -x git_plus_glyph '+'
set -x git_minus_glyph '-' set -x git_minus_glyph -
set -x git_plus_minus_glyph '±' set -x git_plus_minus_glyph '±'
# Fossil glyph (it reuses most of the git glyphs) # Fossil glyph (it reuses most of the git glyphs)
set -x fossil_glyph \U1F9B4 # Unicode bone emoji set -x fossil_glyph \U1F9B4 # Unicode bone emoji
# Disable Powerline fonts (unless we're using nerd fonts instead) # Disable Powerline fonts (unless we're using nerd fonts instead)
if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ] if [ "$theme_powerline_fonts" = no -a "$theme_nerd_fonts" != yes ]
set private_glyph \u29B8 ' ' set private_glyph \u29B8 ' '
set branch_glyph \u2387 set branch_glyph \u2387
set right_black_arrow_glyph '' set right_black_arrow_glyph ''
set right_arrow_glyph '' set right_arrow_glyph ''
set left_black_arrow_glyph '' set left_black_arrow_glyph ''
set left_arrow_glyph '' set left_arrow_glyph ''
end end
# Use prettier Nerd Fonts glyphs # Use prettier Nerd Fonts glyphs
if [ "$theme_nerd_fonts" = "yes" ] if [ "$theme_nerd_fonts" = yes ]
set private_glyph \uF023 ' ' # nf-fa-lock set private_glyph \uF023 ' ' # nf-fa-lock
set branch_glyph \uF418 set branch_glyph \uF418
set detached_glyph \uF417 set detached_glyph \uF417
set tag_glyph \uF412 set tag_glyph \uF412
set nix_glyph \uF313 ' ' # nf-linux-nixos set nix_glyph \uF313 ' ' # nf-linux-nixos
set virtualenv_glyph \uE73C ' ' set virtualenv_glyph \uE73C ' '
set ruby_glyph \uE791 ' ' set ruby_glyph \uE791 ' '
set go_glyph \uE626 ' ' set go_glyph \uE626 ' '
set node_glyph \uE718 ' ' set node_glyph \uE718 ' '
set vagrant_running_glyph \uF431 # ↑ 'running' set vagrant_running_glyph \uF431 # ↑ 'running'
set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff' set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff'
set vagrant_aborted_glyph \uF468 # ✕ 'aborted' set vagrant_aborted_glyph \uF468 # ✕ 'aborted'
set vagrant_unknown_glyph \uF421 # strange cases set vagrant_unknown_glyph \uF421 # strange cases
set git_dirty_glyph \uF448 '' # nf-oct-pencil set git_dirty_glyph \uF448 '' # nf-oct-pencil
set git_staged_glyph \uF0C7 '' # nf-fa-save set git_staged_glyph \uF0C7 '' # nf-fa-save
set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip
set git_untracked_glyph \uF128 '' # nf-fa-question set git_untracked_glyph \uF128 '' # nf-fa-question
# set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h # set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h
set fossil_glyph \UF00B9 # nf-md-bone set fossil_glyph \UF00B9 # nf-md-bone
set git_ahead_glyph \uF47B # nf-oct-chevron_up set git_ahead_glyph \uF47B # nf-oct-chevron_up
set git_behind_glyph \uF47C # nf-oct-chevron_down set git_behind_glyph \uF47C # nf-oct-chevron_down
set git_plus_glyph \uF0DE # fa-sort-asc set git_plus_glyph \uF0DE # fa-sort-asc
set git_minus_glyph \uF0DD # fa-sort-desc set git_minus_glyph \uF0DD # fa-sort-desc
set git_plus_minus_glyph \uF0DC # fa-sort set git_plus_minus_glyph \uF0DC # fa-sort
end end
# Avoid ambiguous glyphs # Avoid ambiguous glyphs
if [ "$theme_avoid_ambiguous_glyphs" = "yes" ] if [ "$theme_avoid_ambiguous_glyphs" = yes ]
set git_untracked_glyph '...' set git_untracked_glyph '...'
set fossil_glyph '' # blank, for lack of a good fallback set fossil_glyph '' # blank, for lack of a good fallback
end end
end end

View File

@@ -1,170 +1,170 @@
function bobthefish_display_colors -a color_scheme -d 'Print example prompt color schemes' function bobthefish_display_colors -a color_scheme -d 'Print example prompt color schemes'
set -l color_schemes default light \ set -l color_schemes default light \
solarized solarized-light \ solarized solarized-light \
base16 base16-light \ base16 base16-light \
gruvbox gruvbox-light zenburn \ gruvbox gruvbox-light zenburn \
dracula nord \ dracula nord \
catppuccin-latte catppuccin-frappe \ catppuccin-latte catppuccin-frappe \
catppuccin-macchiato catppuccin-mocha \ catppuccin-macchiato catppuccin-mocha \
jellybeans \ jellybeans \
terminal terminal-dark-white \ terminal terminal-dark-white \
terminal-light terminal-light-black \ terminal-light terminal-light-black \
terminal2 terminal2-dark-white \ terminal2 terminal2-dark-white \
terminal2-light terminal2-light-black terminal2-light terminal2-light-black
switch "$color_scheme" switch "$color_scheme"
case '--all' case --all
for scheme in $color_schemes for scheme in $color_schemes
echo echo
echo "$scheme:" echo "$scheme:"
bobthefish_display_colors $scheme bobthefish_display_colors $scheme
end end
return return
case $color_schemes case $color_schemes
__bobthefish_colors $color_scheme __bobthefish_colors $color_scheme
case '' case ''
if type -q bobthefish_colors if type -q bobthefish_colors
if [ -n "$theme_color_scheme" ] if [ -n "$theme_color_scheme" ]
echo "$theme_color_scheme (with bobthefish_colors overrides):" echo "$theme_color_scheme (with bobthefish_colors overrides):"
else else
echo 'custom (via bobthefish_colors):' echo 'custom (via bobthefish_colors):'
end end
else if [ -n "$theme_color_scheme" ] else if [ -n "$theme_color_scheme" ]
echo "$theme_color_scheme:" echo "$theme_color_scheme:"
end end
__bobthefish_colors $theme_color_scheme __bobthefish_colors $theme_color_scheme
type -q bobthefish_colors type -q bobthefish_colors
and bobthefish_colors and bobthefish_colors
case '*' case '*'
echo 'usage: bobthefish_display_colors [--all] [color_scheme]' echo 'usage: bobthefish_display_colors [--all] [color_scheme]'
return return
end end
__bobthefish_glyphs __bobthefish_glyphs
echo echo
set_color normal set_color normal
__bobthefish_start_segment $color_initial_segment_exit __bobthefish_start_segment $color_initial_segment_exit
echo -n exit $nonzero_exit_glyph echo -n exit $nonzero_exit_glyph
set_color -b $color_initial_segment_private set_color -b $color_initial_segment_private
echo -n private $private_glyph echo -n private $private_glyph
set_color -b $color_initial_segment_su set_color -b $color_initial_segment_su
echo -n su $superuser_glyph echo -n su $superuser_glyph
set_color -b $color_initial_segment_jobs set_color -b $color_initial_segment_jobs
echo -n jobs $bg_job_glyph echo -n jobs $bg_job_glyph
__bobthefish_finish_segments __bobthefish_finish_segments
set_color normal set_color normal
echo -n "(<- initial_segment)" echo -n "(<- initial_segment)"
echo echo
__bobthefish_start_segment $color_path __bobthefish_start_segment $color_path
echo -n /color/path/ echo -n /color/path/
set_color -b $color_path_basename set_color -b $color_path_basename
echo -ns basename ' ' echo -ns basename ' '
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_path_nowrite __bobthefish_start_segment $color_path_nowrite
echo -n /color/path/nowrite/ echo -n /color/path/nowrite/
set_color -b $color_path_nowrite_basename set_color -b $color_path_nowrite_basename
echo -ns basename ' ' echo -ns basename ' '
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_path __bobthefish_start_segment $color_path
echo -n /color/path/ echo -n /color/path/
set_color -b $color_path_basename set_color -b $color_path_basename
echo -ns basename ' ' echo -ns basename ' '
__bobthefish_start_segment $color_repo __bobthefish_start_segment $color_repo
echo -n "$branch_glyph repo $git_stashed_glyph " echo -n "$branch_glyph repo $git_stashed_glyph "
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_path __bobthefish_start_segment $color_path
echo -n /color/path/ echo -n /color/path/
set_color -b $color_path_basename set_color -b $color_path_basename
echo -ns basename ' ' echo -ns basename ' '
__bobthefish_start_segment $color_repo_dirty __bobthefish_start_segment $color_repo_dirty
echo -n "$tag_glyph repo_dirty $git_dirty_glyph " echo -n "$tag_glyph repo_dirty $git_dirty_glyph "
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_path __bobthefish_start_segment $color_path
echo -n /color/path/ echo -n /color/path/
set_color -b $color_path_basename set_color -b $color_path_basename
echo -ns basename ' ' echo -ns basename ' '
__bobthefish_start_segment $color_repo_staged __bobthefish_start_segment $color_repo_staged
echo -n "$detached_glyph repo_staged $git_staged_glyph " echo -n "$detached_glyph repo_staged $git_staged_glyph "
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_vi_mode_default __bobthefish_start_segment $color_vi_mode_default
echo -ns vi_mode_default ' ' echo -ns vi_mode_default ' '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_vi_mode_insert __bobthefish_start_segment $color_vi_mode_insert
echo -ns vi_mode_insert ' ' echo -ns vi_mode_insert ' '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_vi_mode_visual __bobthefish_start_segment $color_vi_mode_visual
echo -ns vi_mode_visual ' ' echo -ns vi_mode_visual ' '
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_vagrant __bobthefish_start_segment $color_vagrant
echo -ns $vagrant_running_glyph ' ' vagrant ' ' echo -ns $vagrant_running_glyph ' ' vagrant ' '
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_username __bobthefish_start_segment $color_username
echo -n username echo -n username
set_color normal set_color normal
set_color -b $color_hostname[1] $color_hostname[2..-1] set_color -b $color_hostname[1] $color_hostname[2..-1]
echo -ns @hostname ' ' echo -ns @hostname ' '
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_screen __bobthefish_start_segment $color_screen
echo -ns 'screen ' echo -ns 'screen '
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_rvm __bobthefish_start_segment $color_rvm
echo -ns $ruby_glyph rvm ' ' echo -ns $ruby_glyph rvm ' '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_nvm __bobthefish_start_segment $color_nvm
echo -ns $ruby_glyph nvm ' ' echo -ns $ruby_glyph nvm ' '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_virtualfish __bobthefish_start_segment $color_virtualfish
echo -ns $virtualenv_glyph virtualfish ' ' echo -ns $virtualenv_glyph virtualfish ' '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_virtualgo __bobthefish_start_segment $color_virtualgo
echo -ns $go_glyph virtualgo ' ' echo -ns $go_glyph virtualgo ' '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_desk __bobthefish_start_segment $color_desk
echo -ns $desk_glyph desk ' ' echo -ns $desk_glyph desk ' '
__bobthefish_finish_segments __bobthefish_finish_segments
echo echo
__bobthefish_start_segment $color_aws_vault __bobthefish_start_segment $color_aws_vault
echo -ns aws-vault ' (' active ') ' echo -ns aws-vault ' (' active ') '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_aws_vault_expired __bobthefish_start_segment $color_aws_vault_expired
echo -ns aws-vault ' (' expired ') ' echo -ns aws-vault ' (' expired ') '
__bobthefish_finish_segments __bobthefish_finish_segments
__bobthefish_start_segment $color_k8s __bobthefish_start_segment $color_k8s
echo -ns $k8s_glyph ' k8s-context' echo -ns $k8s_glyph ' k8s-context'
__bobthefish_finish_segments __bobthefish_finish_segments
echo -e "\n" echo -e "\n"
end end

View File

@@ -7,13 +7,13 @@
# set -g theme_display_vi no # set -g theme_display_vi no
function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator' function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator'
[ "$theme_display_vi" != 'no' ] [ "$theme_display_vi" != no ]
or return or return
[ "$fish_key_bindings" = 'fish_vi_key_bindings' \ [ "$fish_key_bindings" = fish_vi_key_bindings \
-o "$fish_key_bindings" = 'hybrid_bindings' \ -o "$fish_key_bindings" = hybrid_bindings \
-o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \ -o "$fish_key_bindings" = fish_hybrid_key_bindings \
-o "$theme_display_vi" = 'yes' ] -o "$theme_display_vi" = yes ]
or return or return
__bobthefish_colors $theme_color_scheme __bobthefish_colors $theme_color_scheme

View File

@@ -51,14 +51,14 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish
[ -n "$theme_git_default_branches" ] [ -n "$theme_git_default_branches" ]
or set -l theme_git_default_branches master main (git config init.defaultBranch) 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' ] [ "$theme_display_git_master_branch" != yes -a "$theme_display_git_default_branch" != yes ]
and contains $branch $theme_git_default_branches and contains $branch $theme_git_default_branches
and echo $branch_glyph and echo $branch_glyph
and return and return
# truncate the middle of the branch name, but only if it's 25+ characters # truncate the middle of the branch name, but only if it's 25+ characters
set -l truncname $branch set -l truncname $branch
[ "$theme_use_abbreviated_branch_name" = 'yes' ] [ "$theme_use_abbreviated_branch_name" = yes ]
and set truncname (string replace -r '^(.{17}).{3,}(.{5})$' "\$1…\$2" $branch) and set truncname (string replace -r '^(.{17}).{3,}(.{5})$' "\$1…\$2" $branch)
echo $branch_glyph $truncname echo $branch_glyph $truncname
@@ -117,7 +117,7 @@ function __bobthefish_ignore_vcs_dir -a real_pwd -d 'Check whether the current d
end end
function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git project base directory' function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git project base directory'
[ "$theme_display_git" = 'no' ] [ "$theme_display_git" = no ]
and return and return
command -q git command -q git
@@ -127,7 +127,7 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p
and [ (__bobthefish_ignore_vcs_dir $real_pwd) ] and [ (__bobthefish_ignore_vcs_dir $real_pwd) ]
and return and return
if [ "$theme_git_worktree_support" != 'yes' ] if [ "$theme_git_worktree_support" != yes ]
set -l git_toplevel (command git rev-parse --show-toplevel 2>/dev/null) set -l git_toplevel (command git rev-parse --show-toplevel 2>/dev/null)
[ -z "$git_toplevel" ] [ -z "$git_toplevel" ]
@@ -152,7 +152,7 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p
return return
end end
[ "$d" = '/' ] [ "$d" = / ]
and return and return
set d (__bobthefish_dirname $d) set d (__bobthefish_dirname $d)
@@ -199,7 +199,7 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p
end end
function __bobthefish_fossil_project_dir -S -a real_pwd -d 'Print the current fossil project base directory' function __bobthefish_fossil_project_dir -S -a real_pwd -d 'Print the current fossil project base directory'
[ "$theme_display_fossil" = 'yes' ] [ "$theme_display_fossil" = yes ]
and command -q fossil and command -q fossil
and set -f dir (command fossil json status 2>/dev/null | grep localRoot | string split ':' -f2 | string trim --chars='"/,') and set -f dir (command fossil json status 2>/dev/null | grep localRoot | string split ':' -f2 | string trim --chars='"/,')
or return or return
@@ -212,7 +212,7 @@ function __bobthefish_fossil_project_dir -S -a real_pwd -d 'Print the current fo
end end
function __bobthefish_hg_project_dir -S -a real_pwd -d 'Print the current hg project base directory' function __bobthefish_hg_project_dir -S -a real_pwd -d 'Print the current hg project base directory'
[ "$theme_display_hg" = 'yes' ] [ "$theme_display_hg" = yes ]
and command -q hg and command -q hg
or return or return
@@ -227,7 +227,7 @@ function __bobthefish_hg_project_dir -S -a real_pwd -d 'Print the current hg pro
return return
end end
[ "$d" = '/' ] [ "$d" = / ]
and return and return
set d (__bobthefish_dirname $d) set d (__bobthefish_dirname $d)
@@ -249,7 +249,7 @@ function __bobthefish_project_pwd -S -a project_root_dir -a real_pwd -d 'Print t
end end
function __bobthefish_git_ahead -S -d 'Print the ahead/behind state for the current branch' function __bobthefish_git_ahead -S -d 'Print the ahead/behind state for the current branch'
if [ "$theme_display_git_ahead_verbose" = 'yes' ] if [ "$theme_display_git_ahead_verbose" = yes ]
__bobthefish_git_ahead_verbose __bobthefish_git_ahead_verbose
return return
end end
@@ -308,7 +308,7 @@ function __bobthefish_git_dirty_verbose -S -d 'Print a more verbose dirty state
end end
function __bobthefish_git_stashed -S -d 'Print the stashed state for the current branch' function __bobthefish_git_stashed -S -d 'Print the stashed state for the current branch'
if [ "$theme_display_git_stashed_verbose" = 'yes' ] if [ "$theme_display_git_stashed_verbose" = yes ]
set -l stashed (command git rev-list --walk-reflogs --count refs/stash 2>/dev/null) set -l stashed (command git rev-list --walk-reflogs --count refs/stash 2>/dev/null)
or return or return
@@ -319,7 +319,6 @@ function __bobthefish_git_stashed -S -d 'Print the stashed state for the current
end end
end end
# ============================== # ==============================
# Segment functions # Segment functions
# ============================== # ==============================
@@ -366,7 +365,7 @@ function __bobthefish_path_segment -S -a segment_dir -a path_type -d 'Display a
switch "$segment_dir" switch "$segment_dir"
case / case /
set directory '/' set directory /
case "$HOME" case "$HOME"
set directory '~' set directory '~'
case '*' case '*'
@@ -374,7 +373,7 @@ function __bobthefish_path_segment -S -a segment_dir -a path_type -d 'Display a
set directory (__bobthefish_basename "$segment_dir") set directory (__bobthefish_basename "$segment_dir")
end end
[ "$theme_show_project_parent" != "no" -o "$path_type" != "project" ] [ "$theme_show_project_parent" != no -o "$path_type" != project ]
and echo -n $parent and echo -n $parent
set_color -b $segment_basename_color set_color -b $segment_basename_color
@@ -388,18 +387,18 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments'
echo -ns $right_black_arrow_glyph ' ' echo -ns $right_black_arrow_glyph ' '
end end
if [ "$theme_newline_cursor" = 'yes' ] if [ "$theme_newline_cursor" = yes ]
echo -ens "\n" echo -ens "\n"
set_color $fish_color_autosuggestion set_color $fish_color_autosuggestion
if set -q theme_newline_prompt if set -q theme_newline_prompt
echo -ens "$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 '> ' echo -ns '> '
else else
echo -ns "$right_arrow_glyph " echo -ns "$right_arrow_glyph "
end end
else if [ "$theme_newline_cursor" = 'clean' ] else if [ "$theme_newline_cursor" = clean ]
echo -ens "\n" echo -ens "\n"
end end
@@ -407,7 +406,6 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments'
set __bobthefish_current_bg set __bobthefish_current_bg
end end
# ============================== # ==============================
# Status segment # Status segment
# ============================== # ==============================
@@ -439,7 +437,7 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a no
[ "$bg_jobs" -eq 0 ] [ "$bg_jobs" -eq 0 ]
and set bg_jobs # clear it out so it doesn't show when `0` and set bg_jobs # clear it out so it doesn't show when `0`
else else
if [ "$theme_display_jobs_verbose" = 'yes' ] if [ "$theme_display_jobs_verbose" = yes ]
set bg_jobs (jobs -p | wc -l) set bg_jobs (jobs -p | wc -l)
[ "$bg_jobs" -eq 0 ] [ "$bg_jobs" -eq 0 ]
and set bg_jobs # clear it out so it doesn't show when `0` and set bg_jobs # clear it out so it doesn't show when `0`
@@ -457,7 +455,7 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a no
if [ "$nonzero" ] if [ "$nonzero" ]
set_color normal set_color normal
set_color -b $color_initial_segment_exit set_color -b $color_initial_segment_exit
if [ "$theme_show_exit_status" = 'yes' ] if [ "$theme_show_exit_status" = yes ]
echo -ns $last_status ' ' echo -ns $last_status ' '
else else
echo -n $nonzero_exit_glyph echo -n $nonzero_exit_glyph
@@ -484,7 +482,7 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a no
if [ "$bg_jobs" ] if [ "$bg_jobs" ]
set_color normal set_color normal
set_color -b $color_initial_segment_jobs set_color -b $color_initial_segment_jobs
if [ "$theme_display_jobs_verbose" = 'yes' ] if [ "$theme_display_jobs_verbose" = yes ]
echo -ns $bg_job_glyph $bg_jobs ' ' echo -ns $bg_job_glyph $bg_jobs ' '
else else
echo -n $bg_job_glyph echo -n $bg_job_glyph
@@ -493,13 +491,12 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a no
end end
end end
# ============================== # ==============================
# Container and VM segments # Container and VM segments
# ============================== # ==============================
function __bobthefish_prompt_vagrant -S -d 'Display Vagrant status' function __bobthefish_prompt_vagrant -S -d 'Display Vagrant status'
[ "$theme_display_vagrant" = 'yes' -a -f Vagrantfile ] [ "$theme_display_vagrant" = yes -a -f Vagrantfile ]
or return or return
# .vagrant/machines/$machine/$provider/id # .vagrant/machines/$machine/$provider/id
@@ -524,15 +521,15 @@ function __bobthefish_prompt_vagrant_vbox -S -a id -d 'Display VirtualBox Vagran
set -l vm_status (VBoxManage showvminfo --machinereadable $id 2>/dev/null | command grep 'VMState=' | tr -d '"' | cut -d '=' -f 2) set -l vm_status (VBoxManage showvminfo --machinereadable $id 2>/dev/null | command grep 'VMState=' | tr -d '"' | cut -d '=' -f 2)
switch "$vm_status" switch "$vm_status"
case 'running' case running
set vagrant_status "$vagrant_status$vagrant_running_glyph" set vagrant_status "$vagrant_status$vagrant_running_glyph"
case 'poweroff' case poweroff
set vagrant_status "$vagrant_status$vagrant_poweroff_glyph" set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
case 'aborted' case aborted
set vagrant_status "$vagrant_status$vagrant_aborted_glyph" set vagrant_status "$vagrant_status$vagrant_aborted_glyph"
case 'saved' case saved
set vagrant_status "$vagrant_status$vagrant_saved_glyph" set vagrant_status "$vagrant_status$vagrant_saved_glyph"
case 'stopping' case stopping
set vagrant_status "$vagrant_status$vagrant_stopping_glyph" set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
case '' case ''
set vagrant_status "$vagrant_status$vagrant_unknown_glyph" set vagrant_status "$vagrant_status$vagrant_unknown_glyph"
@@ -565,15 +562,15 @@ function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant
set -l vm_status (prlctl list $id -o status 2>/dev/null | command tail -1) set -l vm_status (prlctl list $id -o status 2>/dev/null | command tail -1)
switch "$vm_status" switch "$vm_status"
case 'running' case running
set vagrant_status "$vagrant_status$vagrant_running_glyph" set vagrant_status "$vagrant_status$vagrant_running_glyph"
case 'stopped' case stopped
set vagrant_status "$vagrant_status$vagrant_poweroff_glyph" set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
case 'paused' case paused
set vagrant_status "$vagrant_status$vagrant_saved_glyph" set vagrant_status "$vagrant_status$vagrant_saved_glyph"
case 'suspended' case suspended
set vagrant_status "$vagrant_status$vagrant_saved_glyph" set vagrant_status "$vagrant_status$vagrant_saved_glyph"
case 'stopping' case stopping
set vagrant_status "$vagrant_status$vagrant_stopping_glyph" set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
case '' case ''
set vagrant_status "$vagrant_status$vagrant_unknown_glyph" set vagrant_status "$vagrant_status$vagrant_unknown_glyph"
@@ -587,7 +584,7 @@ function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant
end end
function __bobthefish_prompt_docker -S -d 'Display Docker machine name' function __bobthefish_prompt_docker -S -d 'Display Docker machine name'
[ "$theme_display_docker_machine" = 'no' -o -z "$DOCKER_MACHINE_NAME" ] [ "$theme_display_docker_machine" = no -o -z "$DOCKER_MACHINE_NAME" ]
and return and return
__bobthefish_start_segment $color_vagrant __bobthefish_start_segment $color_vagrant
@@ -623,36 +620,35 @@ function __bobthefish_k8s_namespace -S -d 'Get the current k8s namespace'
end end
function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context' function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
[ "$theme_display_k8s_context" = 'yes' ] [ "$theme_display_k8s_context" = yes ]
or return or return
set -l context (__bobthefish_k8s_context) set -l context (__bobthefish_k8s_context)
or return or return
[ "$theme_display_k8s_namespace" = 'yes' ] [ "$theme_display_k8s_namespace" = yes ]
and set -l namespace (__bobthefish_k8s_namespace) and set -l namespace (__bobthefish_k8s_namespace)
[ -z "$context" -o "$context" = 'default' ] [ -z "$context" -o "$context" = default ]
and [ -z "$namespace" -o "$namespace" = 'default' ] and [ -z "$namespace" -o "$namespace" = default ]
and return and return
set -l segment $k8s_glyph ' ' set -l segment $k8s_glyph ' '
[ "$context" != 'default' ] [ "$context" != default ]
and set segment $segment $context and set segment $segment $context
[ "$namespace" != 'default' ] [ "$namespace" != default ]
and set segment $segment ':' $namespace and set segment $segment ':' $namespace
__bobthefish_start_segment $color_k8s __bobthefish_start_segment $color_k8s
echo -ns $segment ' ' echo -ns $segment ' '
end end
# ============================== # ==============================
# Cloud Tools # Cloud Tools
# ============================== # ==============================
function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile' function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile'
[ "$theme_display_aws_vault_profile" = 'yes' ] [ "$theme_display_aws_vault_profile" = yes ]
or return or return
[ -n "$AWS_VAULT" -a -n "$AWS_CREDENTIAL_EXPIRATION" ] [ -n "$AWS_VAULT" -a -n "$AWS_CREDENTIAL_EXPIRATION" ]
@@ -666,7 +662,7 @@ function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile'
set -l diff_time $diff_mins"m" set -l diff_time $diff_mins"m"
[ $diff_mins -le 0 ] [ $diff_mins -le 0 ]
and set -l diff_time '0m' and set -l diff_time 0m
[ $diff_mins -ge 60 ] [ $diff_mins -ge 60 ]
and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m" and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m"
@@ -679,7 +675,6 @@ function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile'
echo -ns $segment ' ' echo -ns $segment ' '
end end
# ============================== # ==============================
# User / hostname info segments # User / hostname info segments
# ============================== # ==============================
@@ -696,13 +691,13 @@ if not type -q prompt_hostname
end end
function __bobthefish_prompt_user -S -d 'Display current user and hostname' function __bobthefish_prompt_user -S -d 'Display current user and hostname'
[ "$theme_display_user" = 'yes' -o \( "$theme_display_user" != 'no' -a -n "$SSH_CLIENT" \) -o \( -n "$default_user" -a "$USER" != "$default_user" \) ] [ "$theme_display_user" = yes -o \( "$theme_display_user" != no -a -n "$SSH_CLIENT" \) -o \( -n "$default_user" -a "$USER" != "$default_user" \) ]
and set -l display_user and set -l display_user
[ "$theme_display_sudo_user" = 'yes' -a -n "$SUDO_USER" ] [ "$theme_display_sudo_user" = yes -a -n "$SUDO_USER" ]
and set -l display_sudo_user and set -l display_sudo_user
[ "$theme_display_hostname" = 'yes' -o \( "$theme_display_hostname" != 'no' -a -n "$SSH_CLIENT" \) ] [ "$theme_display_hostname" = yes -o \( "$theme_display_hostname" != no -a -n "$SSH_CLIENT" \) ]
and set -l display_hostname and set -l display_hostname
if set -q display_user if set -q display_user
@@ -739,7 +734,6 @@ function __bobthefish_prompt_user -S -d 'Display current user and hostname'
and echo -ns ' ' and echo -ns ' '
end end
# ============================== # ==============================
# Virtual environment segments # Virtual environment segments
# ============================== # ==============================
@@ -782,14 +776,14 @@ function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM'
# If interpreter differs form default interpreter, show everything: # If interpreter differs form default interpreter, show everything:
if [ "$__rvm_default_ruby_interpreter" != "$__rvm_current_ruby_interpreter" ] if [ "$__rvm_default_ruby_interpreter" != "$__rvm_current_ruby_interpreter" ]
if [ "$__rvm_current_ruby_gemset" = 'global' ] if [ "$__rvm_current_ruby_gemset" = global ]
rvm-prompt i v rvm-prompt i v
else else
rvm-prompt i v g rvm-prompt i v g
end end
# If version differs form default version # If version differs form default version
else if [ "$__rvm_default_ruby_version" != "$__rvm_current_ruby_version" ] else if [ "$__rvm_default_ruby_version" != "$__rvm_current_ruby_version" ]
if [ "$__rvm_current_ruby_gemset" = 'global' ] if [ "$__rvm_current_ruby_gemset" = global ]
rvm-prompt v rvm-prompt v
else else
rvm-prompt v g rvm-prompt v g
@@ -801,7 +795,7 @@ function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM'
end end
function __bobthefish_prompt_rubies -S -d 'Display current Ruby information' function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
[ "$theme_display_ruby" = 'no' ] [ "$theme_display_ruby" = no ]
and return and return
set -l ruby_version set -l ruby_version
@@ -845,43 +839,43 @@ end
function __bobthefish_prompt_golang -S -a real_pwd -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 # setting is 'no', don't display the prompt
[ "$theme_display_go" = 'no' ] [ "$theme_display_go" = no ]
and return and return
# find the closest go.mod # find the closest go.mod
set -l gomod_version "0" set -l gomod_version 0
set -l d $real_pwd set -l d $real_pwd
while not [ -z "$d" ] while not [ -z "$d" ]
if [ -e $d/go.mod ] if [ -e $d/go.mod ]
string match -rq '^go\s(?<gomod_version>\S+)' < "$d/go.mod" string match -rq '^go\s(?<gomod_version>\S+)' <"$d/go.mod"
break break
end end
[ "$d" = "/" ] [ "$d" = / ]
and return and return
set d (__bobthefish_dirname $d) set d (__bobthefish_dirname $d)
end end
# no go.mod, not in a go project, don't display the prompt # no go.mod, not in a go project, don't display the prompt
if [ "$gomod_version" = "0" ] if [ "$gomod_version" = 0 ]
return return
end end
# check if there's a Go executable # check if there's a Go executable
set -l no_go_installed "0" set -l no_go_installed 0
set -l actual_go_version "0" set -l actual_go_version 0
set -l high_enough_version "0" set -l high_enough_version 0
if command -q go if command -q go
set actual_go_version (go version | string replace --filter -r 'go version go(\\d+\\.\\d+(?:\\.\\d+)?).*' '$1') set actual_go_version (go version | string replace --filter -r 'go version go(\\d+\\.\\d+(?:\\.\\d+)?).*' '$1')
if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort 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
else else
set no_go_installed "1" set no_go_installed 1
end end
if [ "$high_enough_version" = "1" ] if [ "$high_enough_version" = 1 ]
__bobthefish_start_segment $color_virtualgo __bobthefish_start_segment $color_virtualgo
else else
__bobthefish_start_segment $color_rvm __bobthefish_start_segment $color_rvm
@@ -891,8 +885,8 @@ function __bobthefish_prompt_golang -S -a real_pwd -d 'Display current Go inform
echo -ns "$gomod_version " echo -ns "$gomod_version "
# showing the prompt -- but plain ( for 'yes' ) or verbose? # showing the prompt -- but plain ( for 'yes' ) or verbose?
if [ "$theme_display_go" = "verbose" ] if [ "$theme_display_go" = verbose ]
if [ "$actual_go_version" != "0" ] if [ "$actual_go_version" != 0 ]
# show the prompt with the required version AND the currently available # show the prompt with the required version AND the currently available
# version; same color rules as above # version; same color rules as above
echo -ns " ($actual_go_version)" echo -ns " ($actual_go_version)"
@@ -917,21 +911,21 @@ function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual e
command -q python command -q python
or return or return
[ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" -a -z "$CONDA_DEFAULT_ENV" ] [ "$theme_display_virtualenv" = no -o -z "$VIRTUAL_ENV" -a -z "$CONDA_DEFAULT_ENV" ]
and return and return
set -l version_glyph (__bobthefish_virtualenv_python_version) set -l version_glyph (__bobthefish_virtualenv_python_version)
set -l prompt_style 'default' set -l prompt_style default
if [ "$version_glyph" ] if [ "$version_glyph" ]
__bobthefish_start_segment $color_virtualfish __bobthefish_start_segment $color_virtualfish
if string match -q "Python 2*" (python --version 2>&1 | string trim) if string match -q "Python 2*" (python --version 2>&1 | string trim)
set prompt_style 'verbose' set prompt_style verbose
else if [ "$theme_display_virtualenv" = 'verbose' ] else if [ "$theme_display_virtualenv" = verbose ]
set prompt_style 'verbose' set prompt_style verbose
end end
if [ "$prompt_style" = 'verbose' ] if [ "$prompt_style" = verbose ]
echo -ns $virtualenv_glyph $version_glyph ' ' echo -ns $virtualenv_glyph $version_glyph ' '
else else
echo -ns $virtualenv_glyph echo -ns $virtualenv_glyph
@@ -947,7 +941,7 @@ function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual e
end end
function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environment' function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environment'
[ "$theme_display_virtualgo" = 'no' -o -z "$VIRTUALGO" ] [ "$theme_display_virtualgo" = no -o -z "$VIRTUALGO" ]
and return and return
__bobthefish_start_segment $color_virtualgo __bobthefish_start_segment $color_virtualgo
@@ -956,7 +950,7 @@ function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environ
end end
function __bobthefish_prompt_desk -S -d 'Display current desk environment' function __bobthefish_prompt_desk -S -d 'Display current desk environment'
[ "$theme_display_desk" = 'no' -o -z "$DESK_ENV" ] [ "$theme_display_desk" = no -o -z "$DESK_ENV" ]
and return and return
__bobthefish_start_segment $color_desk __bobthefish_start_segment $color_desk
@@ -980,7 +974,7 @@ function __bobthefish_prompt_find_file_up -S -d 'Find file(s), going up the pare
end end
end end
[ "$dir" = '/' ] [ "$dir" = / ]
and return 1 and return 1
set dir (__bobthefish_dirname "$dir") set dir (__bobthefish_dirname "$dir")
@@ -991,9 +985,9 @@ end
function __bobthefish_prompt_node -S -d 'Display current node version' function __bobthefish_prompt_node -S -d 'Display current node version'
set -l should_show set -l should_show
if [ "$theme_display_node" = 'always' -o "$theme_display_nvm" = 'yes' ] if [ "$theme_display_node" = always -o "$theme_display_nvm" = yes ]
set should_show 1 set should_show 1
else if [ "$theme_display_node" = 'yes' ] else if [ "$theme_display_node" = yes ]
__bobthefish_prompt_find_file_up "$PWD" package.json .nvmrc .node-version __bobthefish_prompt_find_file_up "$PWD" package.json .nvmrc .node-version
and set should_show 1 and set should_show 1
end end
@@ -1005,10 +999,10 @@ function __bobthefish_prompt_node -S -d 'Display current node version'
set -l node_manager_dir set -l node_manager_dir
if type -q nvm if type -q nvm
set node_manager 'nvm' set node_manager nvm
set node_manager_dir $NVM_DIR set node_manager_dir $NVM_DIR
else if command -q fnm else if command -q fnm
set node_manager 'fnm' set node_manager fnm
set node_manager_dir $FNM_DIR set node_manager_dir $FNM_DIR
end end
@@ -1017,7 +1011,7 @@ function __bobthefish_prompt_node -S -d 'Display current node version'
set -l node_version ("$node_manager" current 2> /dev/null) set -l node_version ("$node_manager" current 2> /dev/null)
[ -z $node_version -o "$node_version" = 'none' -o "$node_version" = 'system' ] [ -z $node_version -o "$node_version" = none -o "$node_version" = system ]
and return and return
[ -n "$color_nvm" ] [ -n "$color_nvm" ]
@@ -1029,7 +1023,7 @@ function __bobthefish_prompt_node -S -d 'Display current node version'
end end
function __bobthefish_prompt_nix -S -d 'Display current nix environment' function __bobthefish_prompt_nix -S -d 'Display current nix environment'
[ "$theme_display_nix" = 'no' -o -z "$IN_NIX_SHELL" ] [ "$theme_display_nix" = no -o -z "$IN_NIX_SHELL" ]
and return and return
__bobthefish_start_segment $color_nix __bobthefish_start_segment $color_nix
@@ -1123,7 +1117,7 @@ function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -d 'Display the ac
end end
function __bobthefish_prompt_screen -S -d 'Display the screen name' function __bobthefish_prompt_screen -S -d 'Display the screen name'
[ "$theme_display_screen" = 'no' -o -z "$STY" ] [ "$theme_display_screen" = no -o -z "$STY" ]
and return and return
__bobthefish_start_segment $color_screen __bobthefish_start_segment $color_screen
@@ -1133,11 +1127,11 @@ end
function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the actual git state' function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the actual git state'
set -l dirty '' set -l dirty ''
if [ "$theme_display_git_dirty" != 'no' ] if [ "$theme_display_git_dirty" != no ]
set -l show_dirty (command git config --bool bash.showDirtyState 2>/dev/null) set -l show_dirty (command git config --bool bash.showDirtyState 2>/dev/null)
if [ "$show_dirty" != 'false' ] if [ "$show_dirty" != false ]
set dirty (command git diff --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_dirty_glyph") set dirty (command git diff --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_dirty_glyph")
if [ "$dirty" -a "$theme_display_git_dirty_verbose" = 'yes' ] if [ "$dirty" -a "$theme_display_git_dirty_verbose" = yes ]
set dirty "$dirty"(__bobthefish_git_dirty_verbose) set dirty "$dirty"(__bobthefish_git_dirty_verbose)
end end
end end
@@ -1148,9 +1142,9 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the
set -l ahead (__bobthefish_git_ahead) set -l ahead (__bobthefish_git_ahead)
set -l new '' set -l new ''
if [ "$theme_display_git_untracked" != 'no' ] if [ "$theme_display_git_untracked" != no ]
set -l show_untracked (command git config --bool bash.showUntrackedFiles 2>/dev/null) set -l show_untracked (command git config --bool bash.showUntrackedFiles 2>/dev/null)
if [ "$show_untracked" != 'false' ] if [ "$show_untracked" != false ]
set new (command git ls-files --other --exclude-standard --directory --no-empty-directory "$git_root_dir" 2>/dev/null) set new (command git ls-files --other --exclude-standard --directory --no-empty-directory "$git_root_dir" 2>/dev/null)
if [ "$new" ] if [ "$new" ]
set new "$git_untracked_glyph" set new "$git_untracked_glyph"
@@ -1176,7 +1170,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the
echo -ns (__bobthefish_git_branch) $flags ' ' echo -ns (__bobthefish_git_branch) $flags ' '
set_color normal set_color normal
if [ "$theme_git_worktree_support" != 'yes' ] if [ "$theme_git_worktree_support" != yes ]
set -l project_pwd (__bobthefish_project_pwd $git_root_dir $real_pwd) set -l project_pwd (__bobthefish_project_pwd $git_root_dir $real_pwd)
if [ "$project_pwd" ] if [ "$project_pwd" ]
if [ -w "$real_pwd" ] if [ -w "$real_pwd" ]
@@ -1226,7 +1220,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the
set_color normal set_color normal
set_color -b $colors set_color -b $colors
[ "$project_pwd" ] [ "$project_pwd" ]
and echo -n '/' and echo -n /
end end
echo -ns $project_pwd ' ' echo -ns $project_pwd ' '
@@ -1264,7 +1258,6 @@ function __bobthefish_closest_parent -S
end end
end end
# ============================== # ==============================
# Apply theme # Apply theme
# ============================== # ==============================
@@ -1274,7 +1267,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set -l last_status $status set -l last_status $status
# Use a simple prompt on dumb terminals. # Use a simple prompt on dumb terminals.
if [ "$TERM" = 'dumb' ] if [ "$TERM" = dumb ]
echo '> ' echo '> '
return return
end end
@@ -1316,7 +1309,6 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
__bobthefish_prompt_virtualgo __bobthefish_prompt_virtualgo
__bobthefish_prompt_node __bobthefish_prompt_node
# VCS # VCS
set -l git_root_dir (__bobthefish_git_project_dir $real_pwd) set -l git_root_dir (__bobthefish_git_project_dir $real_pwd)
set -l hg_root_dir (__bobthefish_hg_project_dir $real_pwd) set -l hg_root_dir (__bobthefish_hg_project_dir $real_pwd)

View File

@@ -1,14 +1,14 @@
# See "Right prompt options" in README.md for configuration options # See "Right prompt options" in README.md for configuration options
function __bobthefish_cmd_duration -S -d 'Show command duration' function __bobthefish_cmd_duration -S -d 'Show command duration'
[ "$theme_display_cmd_duration" = "no" ] [ "$theme_display_cmd_duration" = no ]
and return and return
[ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ] [ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]
and return and return
if [ "$CMD_DURATION" -lt 5000 ] if [ "$CMD_DURATION" -lt 5000 ]
echo -ns $CMD_DURATION 'ms' echo -ns $CMD_DURATION ms
else if [ "$CMD_DURATION" -lt 60000 ] else if [ "$CMD_DURATION" -lt 60000 ]
__bobthefish_pretty_ms $CMD_DURATION s __bobthefish_pretty_ms $CMD_DURATION s
else if [ "$CMD_DURATION" -lt 3600000 ] else if [ "$CMD_DURATION" -lt 3600000 ]
@@ -22,7 +22,7 @@ function __bobthefish_cmd_duration -S -d 'Show command duration'
set_color $fish_color_normal set_color $fish_color_normal
set_color $fish_color_autosuggestion set_color $fish_color_autosuggestion
[ "$theme_display_date" = "no" ] [ "$theme_display_date" = no ]
or echo -ns ' ' $__bobthefish_left_arrow_glyph or echo -ns ' ' $__bobthefish_left_arrow_glyph
end end
@@ -54,7 +54,7 @@ function __bobthefish_pretty_ms -S -a ms -a interval -d 'Millisecond formatting
end end
function __bobthefish_timestamp -S -d 'Show the current timestamp' function __bobthefish_timestamp -S -d 'Show the current timestamp'
[ "$theme_display_date" = "no" ] [ "$theme_display_date" = no ]
and return and return
set -q theme_date_format set -q theme_date_format
@@ -62,13 +62,13 @@ function __bobthefish_timestamp -S -d 'Show the current timestamp'
echo -n ' ' echo -n ' '
set -q theme_date_timezone set -q theme_date_timezone
and env TZ="$theme_date_timezone" date $theme_date_format and env TZ="$theme_date_timezone" date $theme_date_format
or date $theme_date_format or date $theme_date_format
end end
function fish_right_prompt -d 'bobthefish is all about the right prompt' function fish_right_prompt -d 'bobthefish is all about the right prompt'
set -l __bobthefish_left_arrow_glyph \uE0B3 set -l __bobthefish_left_arrow_glyph \uE0B3
if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ] if [ "$theme_powerline_fonts" = no -a "$theme_nerd_fonts" != yes ]
set __bobthefish_left_arrow_glyph '<' set __bobthefish_left_arrow_glyph '<'
end end

View File

@@ -1,7 +1,7 @@
# See "Title options" in README.md for configuration options # See "Title options" in README.md for configuration options
function __bobthefish_title_user -S -d 'Display actual user if different from $default_user' function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
if [ "$theme_title_display_user" = 'yes' ] if [ "$theme_title_display_user" = yes ]
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ] if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
set -l IFS . set -l IFS .
uname -n | read -l host __ uname -n | read -l host __
@@ -13,15 +13,15 @@ end
function fish_title function fish_title
__bobthefish_title_user __bobthefish_title_user
if [ "$theme_title_display_process" = 'yes' ] if [ "$theme_title_display_process" = yes ]
status current-command status current-command
[ "$theme_title_display_path" != 'no' ] [ "$theme_title_display_path" != no ]
and echo ' ' and echo ' '
end end
if [ "$theme_title_display_path" != 'no' ] if [ "$theme_title_display_path" != no ]
if [ "$theme_title_use_abbreviated_path" = 'no' ] if [ "$theme_title_use_abbreviated_path" = no ]
echo $PWD echo $PWD
else else
prompt_pwd prompt_pwd

View File

@@ -2,18 +2,18 @@ set -l required_version 2.3.0
set -l installed_version 1 set -l installed_version 1
if set -q FISH_VERSION if set -q FISH_VERSION
set installed_version $FISH_VERSION set installed_version $FISH_VERSION
else if set -q version else if set -q version
set installed_version $version set installed_version $version
end end
set -l latest_version (echo -e "$required_version\\n$installed_version" | command sort -r -n -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 | command head -n 1) set -l latest_version (echo -e "$required_version\\n$installed_version" | command sort -r -n -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 | command head -n 1)
if [ "$installed_version" != "$latest_version" ] if [ "$installed_version" != "$latest_version" ]
set_color red 2>/dev/null set_color red 2>/dev/null
echo "Fish $required_version or greater is required for bobthefish." echo "Fish $required_version or greater is required for bobthefish."
echo echo
echo "To use bobthefish with Fish $installed_version, checkout the `support/fish-2.2.x` branch" echo "To use bobthefish with Fish $installed_version, checkout the `support/fish-2.2.x` branch"
echo "in $OMF_PATH/themes/bobthefish/" echo "in $OMF_PATH/themes/bobthefish/"
set color normal 2>/dev/null set color normal 2>/dev/null
end end