mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2026-09-22 11:54:08 +00:00
Run fish_indent
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
function __bobthefish_display_colors -d 'Print example prompts using the current color scheme'
|
||||
bobthefish_display_colors
|
||||
bobthefish_display_colors
|
||||
end
|
||||
|
||||
@@ -1,104 +1,104 @@
|
||||
function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish'
|
||||
# Powerline glyphs
|
||||
set -x branch_glyph \uE0A0
|
||||
set -x right_black_arrow_glyph \uE0B0
|
||||
set -x right_arrow_glyph \uE0B1
|
||||
set -x left_black_arrow_glyph \uE0B2
|
||||
set -x left_arrow_glyph \uE0B3
|
||||
# Powerline glyphs
|
||||
set -x branch_glyph \uE0A0
|
||||
set -x right_black_arrow_glyph \uE0B0
|
||||
set -x right_arrow_glyph \uE0B1
|
||||
set -x left_black_arrow_glyph \uE0B2
|
||||
set -x left_arrow_glyph \uE0B3
|
||||
|
||||
# Additional glyphs
|
||||
set -x detached_glyph \u27A6
|
||||
set -x tag_glyph \u2302
|
||||
set -x nonzero_exit_glyph '! '
|
||||
set -x private_glyph \uE0A2 ' '
|
||||
set -x superuser_glyph '$ '
|
||||
set -x bg_job_glyph '% '
|
||||
set -x hg_glyph \u263F
|
||||
# Additional glyphs
|
||||
set -x detached_glyph \u27A6
|
||||
set -x tag_glyph \u2302
|
||||
set -x nonzero_exit_glyph '! '
|
||||
set -x private_glyph \uE0A2 ' '
|
||||
set -x superuser_glyph '$ '
|
||||
set -x bg_job_glyph '% '
|
||||
set -x hg_glyph \u263F
|
||||
|
||||
# Python glyphs
|
||||
set -x superscript_glyph \u00B9 \u00B2 \u00B3
|
||||
set -x virtualenv_glyph \u25F0
|
||||
set -x pypy_glyph \u1D56
|
||||
# Python glyphs
|
||||
set -x superscript_glyph \u00B9 \u00B2 \u00B3
|
||||
set -x virtualenv_glyph \u25F0
|
||||
set -x pypy_glyph \u1D56
|
||||
|
||||
set -x ruby_glyph ''
|
||||
set -x go_glyph ''
|
||||
set -x nix_glyph ''
|
||||
set -x ruby_glyph ''
|
||||
set -x go_glyph ''
|
||||
set -x nix_glyph ''
|
||||
|
||||
# Desk glyphs
|
||||
set -x desk_glyph \u25F2
|
||||
# Desk glyphs
|
||||
set -x desk_glyph \u25F2
|
||||
|
||||
# Kubernetes glyphs
|
||||
set -x k8s_glyph \u2388 # '⎈'
|
||||
# Kubernetes glyphs
|
||||
set -x k8s_glyph \u2388 # '⎈'
|
||||
|
||||
# Vagrant glyphs
|
||||
set -x vagrant_running_glyph \u2191 # ↑ 'running'
|
||||
set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff'
|
||||
set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted'
|
||||
set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved'
|
||||
set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping'
|
||||
set -x vagrant_unknown_glyph '!' # strange cases
|
||||
# Vagrant glyphs
|
||||
set -x vagrant_running_glyph \u2191 # ↑ 'running'
|
||||
set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff'
|
||||
set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted'
|
||||
set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved'
|
||||
set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping'
|
||||
set -x vagrant_unknown_glyph '!' # strange cases
|
||||
|
||||
# Git glyphs
|
||||
set -x git_dirty_glyph '*'
|
||||
set -x git_staged_glyph '~'
|
||||
set -x git_stashed_glyph '$'
|
||||
set -x git_untracked_glyph '…'
|
||||
set -x git_ahead_glyph \u2191 # '↑'
|
||||
set -x git_behind_glyph \u2193 # '↓'
|
||||
set -x git_plus_glyph '+'
|
||||
set -x git_minus_glyph '-'
|
||||
set -x git_plus_minus_glyph '±'
|
||||
# Git glyphs
|
||||
set -x git_dirty_glyph '*'
|
||||
set -x git_staged_glyph '~'
|
||||
set -x git_stashed_glyph '$'
|
||||
set -x git_untracked_glyph '…'
|
||||
set -x git_ahead_glyph \u2191 # '↑'
|
||||
set -x git_behind_glyph \u2193 # '↓'
|
||||
set -x git_plus_glyph '+'
|
||||
set -x git_minus_glyph -
|
||||
set -x git_plus_minus_glyph '±'
|
||||
|
||||
# Fossil glyph (it reuses most of the git glyphs)
|
||||
set -x fossil_glyph \U1F9B4 # Unicode bone emoji
|
||||
# Fossil glyph (it reuses most of the git glyphs)
|
||||
set -x fossil_glyph \U1F9B4 # Unicode bone emoji
|
||||
|
||||
# Disable Powerline fonts (unless we're using nerd fonts instead)
|
||||
if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ]
|
||||
set private_glyph \u29B8 ' '
|
||||
set branch_glyph \u2387
|
||||
set right_black_arrow_glyph ''
|
||||
set right_arrow_glyph ''
|
||||
set left_black_arrow_glyph ''
|
||||
set left_arrow_glyph ''
|
||||
end
|
||||
# Disable Powerline fonts (unless we're using nerd fonts instead)
|
||||
if [ "$theme_powerline_fonts" = no -a "$theme_nerd_fonts" != yes ]
|
||||
set private_glyph \u29B8 ' '
|
||||
set branch_glyph \u2387
|
||||
set right_black_arrow_glyph ''
|
||||
set right_arrow_glyph ''
|
||||
set left_black_arrow_glyph ''
|
||||
set left_arrow_glyph ''
|
||||
end
|
||||
|
||||
# Use prettier Nerd Fonts glyphs
|
||||
if [ "$theme_nerd_fonts" = "yes" ]
|
||||
set private_glyph \uF023 ' ' # nf-fa-lock
|
||||
# Use prettier Nerd Fonts glyphs
|
||||
if [ "$theme_nerd_fonts" = yes ]
|
||||
set private_glyph \uF023 ' ' # nf-fa-lock
|
||||
|
||||
set branch_glyph \uF418
|
||||
set detached_glyph \uF417
|
||||
set tag_glyph \uF412
|
||||
set branch_glyph \uF418
|
||||
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 ' '
|
||||
set node_glyph \uE718 ' '
|
||||
set nix_glyph \uF313 ' ' # nf-linux-nixos
|
||||
set virtualenv_glyph \uE73C ' '
|
||||
set ruby_glyph \uE791 ' '
|
||||
set go_glyph \uE626 ' '
|
||||
set node_glyph \uE718 ' '
|
||||
|
||||
set vagrant_running_glyph \uF431 # ↑ 'running'
|
||||
set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff'
|
||||
set vagrant_aborted_glyph \uF468 # ✕ 'aborted'
|
||||
set vagrant_unknown_glyph \uF421 # strange cases
|
||||
set vagrant_running_glyph \uF431 # ↑ 'running'
|
||||
set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff'
|
||||
set vagrant_aborted_glyph \uF468 # ✕ 'aborted'
|
||||
set vagrant_unknown_glyph \uF421 # strange cases
|
||||
|
||||
set git_dirty_glyph \uF448 '' # nf-oct-pencil
|
||||
set git_staged_glyph \uF0C7 '' # nf-fa-save
|
||||
set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip
|
||||
set git_untracked_glyph \uF128 '' # nf-fa-question
|
||||
# set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h
|
||||
set fossil_glyph \UF00B9 # nf-md-bone
|
||||
set git_dirty_glyph \uF448 '' # nf-oct-pencil
|
||||
set git_staged_glyph \uF0C7 '' # nf-fa-save
|
||||
set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip
|
||||
set git_untracked_glyph \uF128 '' # nf-fa-question
|
||||
# set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h
|
||||
set fossil_glyph \UF00B9 # nf-md-bone
|
||||
|
||||
set git_ahead_glyph \uF47B # nf-oct-chevron_up
|
||||
set git_behind_glyph \uF47C # nf-oct-chevron_down
|
||||
set git_ahead_glyph \uF47B # nf-oct-chevron_up
|
||||
set git_behind_glyph \uF47C # nf-oct-chevron_down
|
||||
|
||||
set git_plus_glyph \uF0DE # fa-sort-asc
|
||||
set git_minus_glyph \uF0DD # fa-sort-desc
|
||||
set git_plus_minus_glyph \uF0DC # fa-sort
|
||||
end
|
||||
set git_plus_glyph \uF0DE # fa-sort-asc
|
||||
set git_minus_glyph \uF0DD # fa-sort-desc
|
||||
set git_plus_minus_glyph \uF0DC # fa-sort
|
||||
end
|
||||
|
||||
# Avoid ambiguous glyphs
|
||||
if [ "$theme_avoid_ambiguous_glyphs" = "yes" ]
|
||||
set git_untracked_glyph '...'
|
||||
set fossil_glyph '' # blank, for lack of a good fallback
|
||||
end
|
||||
# Avoid ambiguous glyphs
|
||||
if [ "$theme_avoid_ambiguous_glyphs" = yes ]
|
||||
set git_untracked_glyph '...'
|
||||
set fossil_glyph '' # blank, for lack of a good fallback
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,170 +1,170 @@
|
||||
function bobthefish_display_colors -a color_scheme -d 'Print example prompt color schemes'
|
||||
|
||||
set -l color_schemes default light \
|
||||
solarized solarized-light \
|
||||
base16 base16-light \
|
||||
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 \
|
||||
terminal2-light terminal2-light-black
|
||||
set -l color_schemes default light \
|
||||
solarized solarized-light \
|
||||
base16 base16-light \
|
||||
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 \
|
||||
terminal2-light terminal2-light-black
|
||||
|
||||
switch "$color_scheme"
|
||||
case '--all'
|
||||
for scheme in $color_schemes
|
||||
echo
|
||||
echo "$scheme:"
|
||||
bobthefish_display_colors $scheme
|
||||
end
|
||||
return
|
||||
switch "$color_scheme"
|
||||
case --all
|
||||
for scheme in $color_schemes
|
||||
echo
|
||||
echo "$scheme:"
|
||||
bobthefish_display_colors $scheme
|
||||
end
|
||||
return
|
||||
|
||||
case $color_schemes
|
||||
__bobthefish_colors $color_scheme
|
||||
case $color_schemes
|
||||
__bobthefish_colors $color_scheme
|
||||
|
||||
case ''
|
||||
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
|
||||
case ''
|
||||
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
|
||||
__bobthefish_colors $theme_color_scheme
|
||||
type -q bobthefish_colors
|
||||
and bobthefish_colors
|
||||
|
||||
case '*'
|
||||
echo 'usage: bobthefish_display_colors [--all] [color_scheme]'
|
||||
return
|
||||
end
|
||||
case '*'
|
||||
echo 'usage: bobthefish_display_colors [--all] [color_scheme]'
|
||||
return
|
||||
end
|
||||
|
||||
__bobthefish_glyphs
|
||||
__bobthefish_glyphs
|
||||
|
||||
echo
|
||||
set_color normal
|
||||
echo
|
||||
set_color normal
|
||||
|
||||
__bobthefish_start_segment $color_initial_segment_exit
|
||||
echo -n exit $nonzero_exit_glyph
|
||||
set_color -b $color_initial_segment_private
|
||||
echo -n private $private_glyph
|
||||
set_color -b $color_initial_segment_su
|
||||
echo -n su $superuser_glyph
|
||||
set_color -b $color_initial_segment_jobs
|
||||
echo -n jobs $bg_job_glyph
|
||||
__bobthefish_finish_segments
|
||||
set_color normal
|
||||
echo -n "(<- initial_segment)"
|
||||
echo
|
||||
__bobthefish_start_segment $color_initial_segment_exit
|
||||
echo -n exit $nonzero_exit_glyph
|
||||
set_color -b $color_initial_segment_private
|
||||
echo -n private $private_glyph
|
||||
set_color -b $color_initial_segment_su
|
||||
echo -n su $superuser_glyph
|
||||
set_color -b $color_initial_segment_jobs
|
||||
echo -n jobs $bg_job_glyph
|
||||
__bobthefish_finish_segments
|
||||
set_color normal
|
||||
echo -n "(<- initial_segment)"
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path_nowrite
|
||||
echo -n /color/path/nowrite/
|
||||
set_color -b $color_path_nowrite_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_path_nowrite
|
||||
echo -n /color/path/nowrite/
|
||||
set_color -b $color_path_nowrite_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo
|
||||
echo -n "$branch_glyph repo $git_stashed_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo
|
||||
echo -n "$branch_glyph repo $git_stashed_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo_dirty
|
||||
echo -n "$tag_glyph repo_dirty $git_dirty_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo_dirty
|
||||
echo -n "$tag_glyph repo_dirty $git_dirty_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo_staged
|
||||
echo -n "$detached_glyph repo_staged $git_staged_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_path
|
||||
echo -n /color/path/
|
||||
set_color -b $color_path_basename
|
||||
echo -ns basename ' '
|
||||
__bobthefish_start_segment $color_repo_staged
|
||||
echo -n "$detached_glyph repo_staged $git_staged_glyph "
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_vi_mode_default
|
||||
echo -ns vi_mode_default ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_vi_mode_insert
|
||||
echo -ns vi_mode_insert ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_vi_mode_visual
|
||||
echo -ns vi_mode_visual ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_vi_mode_default
|
||||
echo -ns vi_mode_default ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_vi_mode_insert
|
||||
echo -ns vi_mode_insert ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_vi_mode_visual
|
||||
echo -ns vi_mode_visual ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
echo -ns $vagrant_running_glyph ' ' vagrant ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
echo -ns $vagrant_running_glyph ' ' vagrant ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_username
|
||||
echo -n username
|
||||
set_color normal
|
||||
set_color -b $color_hostname[1] $color_hostname[2..-1]
|
||||
echo -ns @hostname ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_username
|
||||
echo -n username
|
||||
set_color normal
|
||||
set_color -b $color_hostname[1] $color_hostname[2..-1]
|
||||
echo -ns @hostname ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_screen
|
||||
echo -ns 'screen '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_screen
|
||||
echo -ns 'screen '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_rvm
|
||||
echo -ns $ruby_glyph rvm ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_rvm
|
||||
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_nvm
|
||||
echo -ns $ruby_glyph nvm ' '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
__bobthefish_start_segment $color_virtualfish
|
||||
echo -ns $virtualenv_glyph virtualfish ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_virtualfish
|
||||
echo -ns $virtualenv_glyph virtualfish ' '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
__bobthefish_start_segment $color_virtualgo
|
||||
echo -ns $go_glyph virtualgo ' '
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_virtualgo
|
||||
echo -ns $go_glyph virtualgo ' '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
__bobthefish_start_segment $color_desk
|
||||
echo -ns $desk_glyph desk ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
__bobthefish_start_segment $color_desk
|
||||
echo -ns $desk_glyph desk ' '
|
||||
__bobthefish_finish_segments
|
||||
echo
|
||||
|
||||
__bobthefish_start_segment $color_aws_vault
|
||||
echo -ns aws-vault ' (' active ') '
|
||||
__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
|
||||
__bobthefish_start_segment $color_aws_vault_expired
|
||||
echo -ns aws-vault ' (' expired ') '
|
||||
__bobthefish_finish_segments
|
||||
|
||||
__bobthefish_start_segment $color_k8s
|
||||
echo -ns $k8s_glyph ' k8s-context'
|
||||
__bobthefish_finish_segments
|
||||
__bobthefish_start_segment $color_k8s
|
||||
echo -ns $k8s_glyph ' k8s-context'
|
||||
__bobthefish_finish_segments
|
||||
|
||||
echo -e "\n"
|
||||
echo -e "\n"
|
||||
end
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
# set -g theme_display_vi no
|
||||
|
||||
function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator'
|
||||
[ "$theme_display_vi" != 'no' ]
|
||||
[ "$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' ]
|
||||
[ "$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
|
||||
|
||||
@@ -51,14 +51,14 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish
|
||||
[ -n "$theme_git_default_branches" ]
|
||||
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 echo $branch_glyph
|
||||
and return
|
||||
|
||||
# truncate the middle of the branch name, but only if it's 25+ characters
|
||||
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)
|
||||
|
||||
echo $branch_glyph $truncname
|
||||
@@ -117,7 +117,7 @@ function __bobthefish_ignore_vcs_dir -a real_pwd -d 'Check whether the current d
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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 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)
|
||||
|
||||
[ -z "$git_toplevel" ]
|
||||
@@ -152,7 +152,7 @@ function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git p
|
||||
return
|
||||
end
|
||||
|
||||
[ "$d" = '/' ]
|
||||
[ "$d" = / ]
|
||||
and return
|
||||
|
||||
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
|
||||
|
||||
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 set -f dir (command fossil json status 2>/dev/null | grep localRoot | string split ':' -f2 | string trim --chars='"/,')
|
||||
or return
|
||||
@@ -212,7 +212,7 @@ function __bobthefish_fossil_project_dir -S -a real_pwd -d 'Print the current fo
|
||||
end
|
||||
|
||||
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
|
||||
or return
|
||||
|
||||
@@ -227,7 +227,7 @@ function __bobthefish_hg_project_dir -S -a real_pwd -d 'Print the current hg pro
|
||||
return
|
||||
end
|
||||
|
||||
[ "$d" = '/' ]
|
||||
[ "$d" = / ]
|
||||
and return
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
return
|
||||
end
|
||||
@@ -308,7 +308,7 @@ function __bobthefish_git_dirty_verbose -S -d 'Print a more verbose dirty state
|
||||
end
|
||||
|
||||
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)
|
||||
or return
|
||||
|
||||
@@ -319,7 +319,6 @@ function __bobthefish_git_stashed -S -d 'Print the stashed state for the current
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Segment functions
|
||||
# ==============================
|
||||
@@ -366,7 +365,7 @@ function __bobthefish_path_segment -S -a segment_dir -a path_type -d 'Display a
|
||||
|
||||
switch "$segment_dir"
|
||||
case /
|
||||
set directory '/'
|
||||
set directory /
|
||||
case "$HOME"
|
||||
set directory '~'
|
||||
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")
|
||||
end
|
||||
|
||||
[ "$theme_show_project_parent" != "no" -o "$path_type" != "project" ]
|
||||
[ "$theme_show_project_parent" != no -o "$path_type" != project ]
|
||||
and echo -n $parent
|
||||
|
||||
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 ' '
|
||||
end
|
||||
|
||||
if [ "$theme_newline_cursor" = 'yes' ]
|
||||
if [ "$theme_newline_cursor" = yes ]
|
||||
echo -ens "\n"
|
||||
set_color $fish_color_autosuggestion
|
||||
|
||||
if set -q theme_newline_prompt
|
||||
echo -ens "$theme_newline_prompt"
|
||||
else if [ "$theme_powerline_fonts" = 'no' -a "$theme_nerd_fonts" != 'yes' ]
|
||||
else if [ "$theme_powerline_fonts" = no -a "$theme_nerd_fonts" != yes ]
|
||||
echo -ns '> '
|
||||
else
|
||||
echo -ns "$right_arrow_glyph "
|
||||
end
|
||||
else if [ "$theme_newline_cursor" = 'clean' ]
|
||||
else if [ "$theme_newline_cursor" = clean ]
|
||||
echo -ens "\n"
|
||||
end
|
||||
|
||||
@@ -407,7 +406,6 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments'
|
||||
set __bobthefish_current_bg
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Status segment
|
||||
# ==============================
|
||||
@@ -439,7 +437,7 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a no
|
||||
[ "$bg_jobs" -eq 0 ]
|
||||
and set bg_jobs # clear it out so it doesn't show when `0`
|
||||
else
|
||||
if [ "$theme_display_jobs_verbose" = 'yes' ]
|
||||
if [ "$theme_display_jobs_verbose" = yes ]
|
||||
set bg_jobs (jobs -p | wc -l)
|
||||
[ "$bg_jobs" -eq 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" ]
|
||||
set_color normal
|
||||
set_color -b $color_initial_segment_exit
|
||||
if [ "$theme_show_exit_status" = 'yes' ]
|
||||
if [ "$theme_show_exit_status" = yes ]
|
||||
echo -ns $last_status ' '
|
||||
else
|
||||
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" ]
|
||||
set_color normal
|
||||
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 ' '
|
||||
else
|
||||
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
|
||||
|
||||
|
||||
# ==============================
|
||||
# Container and VM segments
|
||||
# ==============================
|
||||
|
||||
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
|
||||
|
||||
# .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)
|
||||
|
||||
switch "$vm_status"
|
||||
case 'running'
|
||||
case running
|
||||
set vagrant_status "$vagrant_status$vagrant_running_glyph"
|
||||
case 'poweroff'
|
||||
case poweroff
|
||||
set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
|
||||
case 'aborted'
|
||||
case aborted
|
||||
set vagrant_status "$vagrant_status$vagrant_aborted_glyph"
|
||||
case 'saved'
|
||||
case saved
|
||||
set vagrant_status "$vagrant_status$vagrant_saved_glyph"
|
||||
case 'stopping'
|
||||
case stopping
|
||||
set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
|
||||
case ''
|
||||
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)
|
||||
|
||||
switch "$vm_status"
|
||||
case 'running'
|
||||
case running
|
||||
set vagrant_status "$vagrant_status$vagrant_running_glyph"
|
||||
case 'stopped'
|
||||
case stopped
|
||||
set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
|
||||
case 'paused'
|
||||
case paused
|
||||
set vagrant_status "$vagrant_status$vagrant_saved_glyph"
|
||||
case 'suspended'
|
||||
case suspended
|
||||
set vagrant_status "$vagrant_status$vagrant_saved_glyph"
|
||||
case 'stopping'
|
||||
case stopping
|
||||
set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
|
||||
case ''
|
||||
set vagrant_status "$vagrant_status$vagrant_unknown_glyph"
|
||||
@@ -587,7 +584,7 @@ function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
__bobthefish_start_segment $color_vagrant
|
||||
@@ -623,36 +620,35 @@ function __bobthefish_k8s_namespace -S -d 'Get the current k8s namespace'
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
|
||||
[ "$theme_display_k8s_context" = 'yes' ]
|
||||
[ "$theme_display_k8s_context" = yes ]
|
||||
or return
|
||||
|
||||
set -l context (__bobthefish_k8s_context)
|
||||
or return
|
||||
|
||||
[ "$theme_display_k8s_namespace" = 'yes' ]
|
||||
[ "$theme_display_k8s_namespace" = yes ]
|
||||
and set -l namespace (__bobthefish_k8s_namespace)
|
||||
|
||||
[ -z "$context" -o "$context" = 'default' ]
|
||||
and [ -z "$namespace" -o "$namespace" = 'default' ]
|
||||
[ -z "$context" -o "$context" = default ]
|
||||
and [ -z "$namespace" -o "$namespace" = default ]
|
||||
and return
|
||||
|
||||
set -l segment $k8s_glyph ' '
|
||||
[ "$context" != 'default' ]
|
||||
[ "$context" != default ]
|
||||
and set segment $segment $context
|
||||
[ "$namespace" != 'default' ]
|
||||
[ "$namespace" != default ]
|
||||
and set segment $segment ':' $namespace
|
||||
|
||||
__bobthefish_start_segment $color_k8s
|
||||
echo -ns $segment ' '
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Cloud Tools
|
||||
# ==============================
|
||||
|
||||
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
|
||||
|
||||
[ -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"
|
||||
[ $diff_mins -le 0 ]
|
||||
and set -l diff_time '0m'
|
||||
and set -l diff_time 0m
|
||||
[ $diff_mins -ge 60 ]
|
||||
and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m"
|
||||
|
||||
@@ -679,7 +675,6 @@ function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile'
|
||||
echo -ns $segment ' '
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# User / hostname info segments
|
||||
# ==============================
|
||||
@@ -696,13 +691,13 @@ if not type -q prompt_hostname
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
[ "$theme_display_sudo_user" = 'yes' -a -n "$SUDO_USER" ]
|
||||
[ "$theme_display_sudo_user" = yes -a -n "$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
|
||||
|
||||
if set -q display_user
|
||||
@@ -739,7 +734,6 @@ function __bobthefish_prompt_user -S -d 'Display current user and hostname'
|
||||
and echo -ns ' '
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# 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 [ "$__rvm_default_ruby_interpreter" != "$__rvm_current_ruby_interpreter" ]
|
||||
if [ "$__rvm_current_ruby_gemset" = 'global' ]
|
||||
if [ "$__rvm_current_ruby_gemset" = global ]
|
||||
rvm-prompt i v
|
||||
else
|
||||
rvm-prompt i v g
|
||||
end
|
||||
# If version differs form default 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
|
||||
else
|
||||
rvm-prompt v g
|
||||
@@ -801,7 +795,7 @@ function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM'
|
||||
end
|
||||
|
||||
function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
|
||||
[ "$theme_display_ruby" = 'no' ]
|
||||
[ "$theme_display_ruby" = no ]
|
||||
and return
|
||||
|
||||
set -l ruby_version
|
||||
@@ -845,43 +839,43 @@ 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' ]
|
||||
[ "$theme_display_go" = no ]
|
||||
and return
|
||||
|
||||
# find the closest go.mod
|
||||
set -l gomod_version "0"
|
||||
set -l gomod_version 0
|
||||
set -l d $real_pwd
|
||||
while not [ -z "$d" ]
|
||||
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
|
||||
end
|
||||
|
||||
[ "$d" = "/" ]
|
||||
[ "$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" ]
|
||||
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"
|
||||
set -l no_go_installed 0
|
||||
set -l actual_go_version 0
|
||||
set -l high_enough_version 0
|
||||
if command -q go
|
||||
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
|
||||
set high_enough_version "1"
|
||||
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"
|
||||
set no_go_installed 1
|
||||
end
|
||||
|
||||
if [ "$high_enough_version" = "1" ]
|
||||
if [ "$high_enough_version" = 1 ]
|
||||
__bobthefish_start_segment $color_virtualgo
|
||||
else
|
||||
__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 "
|
||||
|
||||
# showing the prompt -- but plain ( for 'yes' ) or verbose?
|
||||
if [ "$theme_display_go" = "verbose" ]
|
||||
if [ "$actual_go_version" != "0" ]
|
||||
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)"
|
||||
@@ -917,21 +911,21 @@ function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual e
|
||||
command -q python
|
||||
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
|
||||
|
||||
set -l version_glyph (__bobthefish_virtualenv_python_version)
|
||||
set -l prompt_style 'default'
|
||||
set -l prompt_style default
|
||||
|
||||
if [ "$version_glyph" ]
|
||||
__bobthefish_start_segment $color_virtualfish
|
||||
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'
|
||||
set prompt_style verbose
|
||||
else if [ "$theme_display_virtualenv" = verbose ]
|
||||
set prompt_style verbose
|
||||
end
|
||||
|
||||
if [ "$prompt_style" = 'verbose' ]
|
||||
if [ "$prompt_style" = verbose ]
|
||||
echo -ns $virtualenv_glyph $version_glyph ' '
|
||||
else
|
||||
echo -ns $virtualenv_glyph
|
||||
@@ -947,7 +941,7 @@ function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual e
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
__bobthefish_start_segment $color_virtualgo
|
||||
@@ -956,7 +950,7 @@ function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environ
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
__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
|
||||
|
||||
[ "$dir" = '/' ]
|
||||
[ "$dir" = / ]
|
||||
and return 1
|
||||
|
||||
set dir (__bobthefish_dirname "$dir")
|
||||
@@ -991,9 +985,9 @@ end
|
||||
function __bobthefish_prompt_node -S -d 'Display current node version'
|
||||
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
|
||||
else if [ "$theme_display_node" = 'yes' ]
|
||||
else if [ "$theme_display_node" = yes ]
|
||||
__bobthefish_prompt_find_file_up "$PWD" package.json .nvmrc .node-version
|
||||
and set should_show 1
|
||||
end
|
||||
@@ -1005,10 +999,10 @@ function __bobthefish_prompt_node -S -d 'Display current node version'
|
||||
set -l node_manager_dir
|
||||
|
||||
if type -q nvm
|
||||
set node_manager 'nvm'
|
||||
set node_manager nvm
|
||||
set node_manager_dir $NVM_DIR
|
||||
else if command -q fnm
|
||||
set node_manager 'fnm'
|
||||
set node_manager fnm
|
||||
set node_manager_dir $FNM_DIR
|
||||
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)
|
||||
|
||||
[ -z $node_version -o "$node_version" = 'none' -o "$node_version" = 'system' ]
|
||||
[ -z $node_version -o "$node_version" = none -o "$node_version" = system ]
|
||||
and return
|
||||
|
||||
[ -n "$color_nvm" ]
|
||||
@@ -1029,7 +1023,7 @@ function __bobthefish_prompt_node -S -d 'Display current node version'
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
__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
|
||||
|
||||
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
|
||||
|
||||
__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'
|
||||
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)
|
||||
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")
|
||||
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)
|
||||
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 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)
|
||||
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)
|
||||
if [ "$new" ]
|
||||
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 ' '
|
||||
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)
|
||||
if [ "$project_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 -b $colors
|
||||
[ "$project_pwd" ]
|
||||
and echo -n '/'
|
||||
and echo -n /
|
||||
end
|
||||
|
||||
echo -ns $project_pwd ' '
|
||||
@@ -1264,7 +1258,6 @@ function __bobthefish_closest_parent -S
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# ==============================
|
||||
# Apply theme
|
||||
# ==============================
|
||||
@@ -1274,7 +1267,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
|
||||
set -l last_status $status
|
||||
|
||||
# Use a simple prompt on dumb terminals.
|
||||
if [ "$TERM" = 'dumb' ]
|
||||
if [ "$TERM" = dumb ]
|
||||
echo '> '
|
||||
return
|
||||
end
|
||||
@@ -1316,7 +1309,6 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
|
||||
__bobthefish_prompt_virtualgo
|
||||
__bobthefish_prompt_node
|
||||
|
||||
|
||||
# VCS
|
||||
set -l git_root_dir (__bobthefish_git_project_dir $real_pwd)
|
||||
set -l hg_root_dir (__bobthefish_hg_project_dir $real_pwd)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# See "Right prompt options" in README.md for configuration options
|
||||
|
||||
function __bobthefish_cmd_duration -S -d 'Show command duration'
|
||||
[ "$theme_display_cmd_duration" = "no" ]
|
||||
[ "$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'
|
||||
echo -ns $CMD_DURATION ms
|
||||
else if [ "$CMD_DURATION" -lt 60000 ]
|
||||
__bobthefish_pretty_ms $CMD_DURATION s
|
||||
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_autosuggestion
|
||||
|
||||
[ "$theme_display_date" = "no" ]
|
||||
[ "$theme_display_date" = no ]
|
||||
or echo -ns ' ' $__bobthefish_left_arrow_glyph
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ function __bobthefish_pretty_ms -S -a ms -a interval -d 'Millisecond formatting
|
||||
end
|
||||
|
||||
function __bobthefish_timestamp -S -d 'Show the current timestamp'
|
||||
[ "$theme_display_date" = "no" ]
|
||||
[ "$theme_display_date" = no ]
|
||||
and return
|
||||
|
||||
set -q theme_date_format
|
||||
@@ -62,13 +62,13 @@ function __bobthefish_timestamp -S -d 'Show the current timestamp'
|
||||
|
||||
echo -n ' '
|
||||
set -q theme_date_timezone
|
||||
and env TZ="$theme_date_timezone" date $theme_date_format
|
||||
or date $theme_date_format
|
||||
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" ]
|
||||
if [ "$theme_powerline_fonts" = no -a "$theme_nerd_fonts" != yes ]
|
||||
set __bobthefish_left_arrow_glyph '<'
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 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' ]
|
||||
if [ "$theme_title_display_user" = yes ]
|
||||
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
|
||||
set -l IFS .
|
||||
uname -n | read -l host __
|
||||
@@ -13,15 +13,15 @@ end
|
||||
function fish_title
|
||||
__bobthefish_title_user
|
||||
|
||||
if [ "$theme_title_display_process" = 'yes' ]
|
||||
if [ "$theme_title_display_process" = yes ]
|
||||
status current-command
|
||||
|
||||
[ "$theme_title_display_path" != 'no' ]
|
||||
[ "$theme_title_display_path" != no ]
|
||||
and echo ' '
|
||||
end
|
||||
|
||||
if [ "$theme_title_display_path" != 'no' ]
|
||||
if [ "$theme_title_use_abbreviated_path" = 'no' ]
|
||||
if [ "$theme_title_display_path" != no ]
|
||||
if [ "$theme_title_use_abbreviated_path" = no ]
|
||||
echo $PWD
|
||||
else
|
||||
prompt_pwd
|
||||
|
||||
@@ -2,18 +2,18 @@ set -l required_version 2.3.0
|
||||
|
||||
set -l installed_version 1
|
||||
if set -q FISH_VERSION
|
||||
set installed_version $FISH_VERSION
|
||||
set installed_version $FISH_VERSION
|
||||
else if set -q version
|
||||
set installed_version $version
|
||||
set installed_version $version
|
||||
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)
|
||||
|
||||
if [ "$installed_version" != "$latest_version" ]
|
||||
set_color red 2>/dev/null
|
||||
echo "Fish $required_version or greater is required for bobthefish."
|
||||
echo
|
||||
echo "To use bobthefish with Fish $installed_version, checkout the `support/fish-2.2.x` branch"
|
||||
echo "in $OMF_PATH/themes/bobthefish/"
|
||||
set color normal 2>/dev/null
|
||||
set_color red 2>/dev/null
|
||||
echo "Fish $required_version or greater is required for bobthefish."
|
||||
echo
|
||||
echo "To use bobthefish with Fish $installed_version, checkout the `support/fish-2.2.x` branch"
|
||||
echo "in $OMF_PATH/themes/bobthefish/"
|
||||
set color normal 2>/dev/null
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user