2013-09-18 06:17:15 +00:00
# name: bobthefish
#
# bobthefish is a Powerline-style, Git-aware fish theme optimized for awesome.
#
2015-10-27 18:05:01 +00:00
# You will need a Powerline-patched font for this to work:
2013-09-18 06:17:15 +00:00
#
2016-02-20 07:10:06 +00:00
# https://powerline.readthedocs.org/en/master/installation.html#patched-fonts
2013-09-18 06:17:15 +00:00
#
# I recommend picking one of these:
#
# https://github.com/Lokaltog/powerline-fonts
#
2016-02-19 06:00:31 +00:00
# For more advanced awesome, install a nerd fonts patched font (and be sure to
# enable nerd fonts support with `set -g theme_nerd_fonts yes`):
#
# https://github.com/ryanoasis/nerd-fonts
#
2015-10-27 18:05:01 +00:00
# You can override some default prompt options in your config.fish:
2013-09-18 06:17:15 +00:00
#
2014-11-22 12:28:40 +00:00
# set -g theme_display_git no
2018-01-10 21:38:42 +00:00
# set -g theme_display_git_dirty no
2015-04-24 17:59:50 +00:00
# set -g theme_display_git_untracked no
2015-06-24 21:50:28 +00:00
# set -g theme_display_git_ahead_verbose yes
2016-03-30 23:57:34 +00:00
# set -g theme_git_worktree_support yes
2015-12-16 18:12:21 +00:00
# set -g theme_display_vagrant yes
2016-06-09 02:31:16 +00:00
# set -g theme_display_docker_machine no
2017-08-08 07:46:20 +00:00
# set -g theme_display_k8s_context no
2014-11-26 17:00:16 +00:00
# set -g theme_display_hg yes
2014-11-22 12:28:40 +00:00
# set -g theme_display_virtualenv no
2014-11-23 20:27:57 +00:00
# set -g theme_display_ruby no
2013-09-18 06:17:15 +00:00
# set -g theme_display_user yes
2017-12-19 15:38:15 +00:00
# set -g theme_display_hostname yes
2016-10-18 14:04:59 +00:00
# set -g theme_display_vi no
2015-10-14 03:34:35 +00:00
# set -g theme_avoid_ambiguous_glyphs yes
2016-05-15 23:43:01 +00:00
# set -g theme_powerline_fonts no
2016-02-19 06:00:31 +00:00
# set -g theme_nerd_fonts yes
2016-03-03 11:12:09 +00:00
# set -g theme_show_exit_status yes
2013-09-18 06:17:15 +00:00
# set -g default_user your_normal_user
2016-06-09 02:31:16 +00:00
# set -g theme_color_scheme dark
2016-12-30 00:12:55 +00:00
# set -g fish_prompt_pwd_dir_length 0
# set -g theme_project_dir_length 1
2017-12-19 15:10:48 +00:00
# set -g theme_newline_cursor yes
2013-09-18 06:17:15 +00:00
2017-12-19 16:32:59 +00:00
# ==============================
# Helper methods
# ==============================
2014-11-16 10:47:15 +00:00
2017-12-24 02:26:29 +00:00
function __bobthefish_basename -d 'basically basename, but faster'
string replace -r '^.*/' '' -- $argv
end
function __bobthefish_dirname -d 'basically dirname, but faster'
string replace -r '/[^/]+/?$' '' -- $argv
end
2016-01-25 15:06:48 +00:00
function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)'
2014-11-23 18:27:18 +00:00
set -l ref ( command git symbolic-ref HEAD ^ /dev/null)
2017-01-30 04:02:01 +00:00
and string replace 'refs/heads/' " $__bobthefish_branch_glyph " $ref
2016-08-25 15:01:08 +00:00
and return
set -l tag ( command git describe --tags --exact-match ^ /dev/null)
and echo " $__bobthefish_tag_glyph $tag "
and return
set -l branch ( command git show-ref --head -s --abbrev | head -n1 ^ /dev/null)
echo " $__bobthefish_detached_glyph $branch "
2013-09-18 06:17:15 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_hg_branch -S -d 'Get the current hg branch'
2014-11-23 18:33:06 +00:00
set -l branch ( command hg branch ^ /dev/null)
2016-03-30 20:24:51 +00:00
set -l book ( command hg book | command grep \* | cut -d \ -f3 )
2015-10-14 04:15:59 +00:00
echo " $__bobthefish_branch_glyph $branch @ $book "
2014-11-16 10:47:15 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_pretty_parent -S -a current_dir -d 'Print a parent directory, shortened to fit the prompt'
2016-12-30 00:12:55 +00:00
set -q fish_prompt_pwd_dir_length
or set -l fish_prompt_pwd_dir_length 1
# Replace $HOME with ~
set -l real_home ~
2017-12-24 02:26:29 +00:00
set -l parent_dir ( string replace -r '^' " $real_home " '($|/)' '~$1' ( __bobthefish_dirname $current_dir ) )
2016-12-30 00:12:55 +00:00
2017-12-24 02:26:29 +00:00
# Must check whether `$parent_dir = /` if using native dirname
if [ - z " $parent_dir " ]
2016-12-30 00:12:55 +00:00
echo -n /
return
end
if [ $fish_prompt_pwd_dir_length - eq 0 ]
echo -n " $parent_dir / "
return
end
string replace -ar '(\.?[^/]{' " $fish_prompt_pwd_dir_length " '})[^/]*/' '$1/' " $parent_dir / "
2013-09-18 06:17:15 +00:00
end
2017-12-19 16:32:59 +00:00
function __bobthefish_ignore_vcs_dir -d 'Check whether the current directory should be ignored as a VCS segment'
2017-12-19 14:52:08 +00:00
for p in $theme_vcs_ignore_paths
set ignore_path ( realpath $p ^ /dev/null)
2017-12-24 03:52:07 +00:00
switch $PWD /
case $ignore_path /\*
echo 1
return
end
2017-10-26 12:27:08 +00:00
end
end
2016-01-25 15:06:48 +00:00
function __bobthefish_git_project_dir -S -d 'Print the current git project base directory'
2014-11-23 20:27:57 +00:00
[ " $theme_display_git " = 'no' ] ; and return
2017-12-19 14:52:08 +00:00
set -q theme_vcs_ignore_paths
2017-12-19 16:32:59 +00:00
and [ ( __bobthefish_ignore_vcs_dir ) ]
2017-12-19 14:52:08 +00:00
and return
2017-10-26 12:27:08 +00:00
2016-03-30 23:57:34 +00:00
if [ " $theme_git_worktree_support " != 'yes' ]
command git rev-parse --show-toplevel ^ /dev/null
return
end
set -l git_dir ( command git rev-parse --git-dir ^ /dev/null) ; or return
pushd $git_dir
set git_dir $PWD
popd
switch $PWD /
case $git_dir /\*
# Nothing works quite right if we're inside the git dir
# TODO: fix the underlying issues then re-enable the stuff below
# # if we're inside the git dir, sweet. just return that.
# set -l toplevel (command git rev-parse --show-toplevel ^/dev/null)
# if [ "$toplevel" ]
# switch $git_dir/
# case $toplevel/\*
# echo $git_dir
# end
# end
return
end
2017-12-24 02:26:29 +00:00
set -l project_dir ( __bobthefish_dirname $git_dir )
2016-03-30 23:57:34 +00:00
switch $PWD /
case $project_dir /\*
echo $project_dir
return
end
set project_dir ( command git rev-parse --show-toplevel ^ /dev/null)
switch $PWD /
case $project_dir /\*
echo $project_dir
end
2013-09-18 06:17:15 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_hg_project_dir -S -d 'Print the current hg project base directory'
2014-11-26 17:00:16 +00:00
[ " $theme_display_hg " = 'yes' ] ; or return
2017-12-19 14:52:08 +00:00
set -q theme_vcs_ignore_paths
2017-12-19 16:32:59 +00:00
and [ ( __bobthefish_ignore_vcs_dir ) ]
2017-12-19 14:52:08 +00:00
and return
2017-10-26 12:27:08 +00:00
2016-03-30 06:28:25 +00:00
set -l d $PWD
2017-12-24 02:26:29 +00:00
# Must check whether `$d = /` if using native dirname
while not [ - z " $d " ]
2014-11-23 22:18:36 +00:00
if [ - e $d /.hg ]
2014-11-23 22:41:29 +00:00
command hg root --cwd " $d " ^ /dev/null
2014-11-23 19:36:12 +00:00
return
end
2017-12-24 02:26:29 +00:00
set d ( __bobthefish_dirname $d )
2014-11-23 19:36:12 +00:00
end
2014-11-16 10:47:15 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_project_pwd -S -a current_dir -d 'Print the working directory relative to project root'
2016-12-30 00:12:55 +00:00
set -q theme_project_dir_length
or set -l theme_project_dir_length 0
set -l project_dir ( string replace -r '^' " $current_dir " '($|/)' '' $PWD )
if [ $theme_project_dir_length - eq 0 ]
echo -n $project_dir
return
end
string replace -ar '(\.?[^/]{' " $theme_project_dir_length " '})[^/]*/' '$1/' $project_dir
2013-09-18 06:17:15 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_git_ahead -S -d 'Print the ahead/behind state for the current branch'
2015-06-24 21:50:28 +00:00
if [ " $theme_display_git_ahead_verbose " = 'yes' ]
__bobthefish_git_ahead_verbose
return
end
2017-01-30 15:33:52 +00:00
set -l ahead 0
set -l behind 0
for line in ( command git rev-list --left-right '@{upstream}...HEAD' ^ /dev/null)
switch " $line "
case '>*'
if [ $behind - eq 1 ]
echo '±'
return
end
set ahead 1
case '<*'
if [ $ahead - eq 1 ]
2017-05-03 19:23:28 +00:00
echo " $__bobthefish_git_plus_minus_glyph "
2017-01-30 15:33:52 +00:00
return
end
set behind 1
end
end
if [ $ahead - eq 1 ]
2017-05-03 19:23:28 +00:00
echo " $__bobthefish_git_plus_glyph "
2017-01-30 15:33:52 +00:00
else if [ $behind - eq 1 ]
2017-05-03 19:23:28 +00:00
echo " $__bobthefish_git_minus_glyph "
2017-01-30 15:33:52 +00:00
end
2015-06-24 21:50:28 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_git_ahead_verbose -S -d 'Print a more verbose ahead/behind state for the current branch'
2015-06-24 21:50:28 +00:00
set -l commits ( command git rev-list --left-right '@{upstream}...HEAD' ^ /dev/null)
2016-03-30 06:28:25 +00:00
[ $status != 0 ] ; and return
2015-06-24 21:50:28 +00:00
2016-03-30 20:24:51 +00:00
set -l behind ( count ( for arg in $commits ; echo $arg ; end | command grep '^<' ) )
set -l ahead ( count ( for arg in $commits ; echo $arg ; end | command grep -v '^<' ) )
2015-06-24 21:50:28 +00:00
switch " $ahead $behind "
case '' # no upstream
case '0 0' # equal to upstream
return
case '* 0' # ahead of upstream
2017-05-03 19:23:28 +00:00
echo " $__bobthefish_git_ahead_glyph $ahead "
2015-06-24 21:50:28 +00:00
case '0 *' # behind upstream
2017-05-03 19:23:28 +00:00
echo " $__bobthefish_git_behind_glyph $behind "
2015-06-24 21:50:28 +00:00
case '*' # diverged from upstream
2017-05-03 19:23:28 +00:00
echo " $__bobthefish_git_ahead_glyph $ahead $__bobthefish_git_behind_glyph $behind "
2015-06-24 21:50:28 +00:00
end
end
2013-09-18 06:17:15 +00:00
2017-12-19 16:32:59 +00:00
# ==============================
2013-09-18 06:17:15 +00:00
# Segment functions
2017-12-19 16:32:59 +00:00
# ==============================
2013-09-18 06:17:15 +00:00
2016-01-25 15:06:48 +00:00
function __bobthefish_start_segment -S -d 'Start a prompt segment'
2014-11-23 17:34:30 +00:00
set -l bg $argv [ 1 ]
set -e argv [ 1 ]
set -l fg $argv [ 1 ]
set -e argv [ 1 ]
set_color normal # clear out anything bold or underline...
2017-02-01 13:13:31 +00:00
set_color -b $bg $fg $argv
2016-02-04 07:10:57 +00:00
switch " $__bobthefish_current_bg "
case ''
# If there's no background, just start one
echo -n ' '
case " $bg "
# If the background is already the same color, draw a separator
2016-03-30 06:28:25 +00:00
echo -ns $__bobthefish_right_arrow_glyph ' '
2016-02-04 07:10:57 +00:00
case '*'
2013-09-18 06:17:15 +00:00
# otherwise, draw the end of the previous segment and the start of the next
2014-05-14 19:37:52 +00:00
set_color $__bobthefish_current_bg
2016-03-30 06:28:25 +00:00
echo -ns $__bobthefish_right_black_arrow_glyph ' '
2014-11-23 17:34:30 +00:00
set_color $fg $argv
2013-09-18 06:17:15 +00:00
end
2016-02-04 07:10:57 +00:00
2014-11-23 17:34:30 +00:00
set __bobthefish_current_bg $bg
2013-09-18 06:17:15 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_path_segment -S -a current_dir -d 'Display a shortened form of a directory'
2016-06-06 20:53:12 +00:00
set -l segment_color $__color_path
set -l segment_basename_color $__color_path_basename
2016-03-30 20:24:51 +00:00
if not [ - w " $current_dir " ]
2016-06-06 20:53:12 +00:00
set segment_color $__color_path_nowrite
set segment_basename_color $__color_path_nowrite_basename
2013-09-18 06:17:15 +00:00
end
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $segment_color
2016-03-30 20:24:51 +00:00
2013-09-18 06:17:15 +00:00
set -l directory
set -l parent
2015-10-14 03:40:44 +00:00
switch " $current_dir "
2013-09-18 06:17:15 +00:00
case /
set directory '/'
case " $HOME "
set directory '~'
case '*'
2015-10-14 03:40:44 +00:00
set parent ( __bobthefish_pretty_parent " $current_dir " )
2017-12-24 02:26:29 +00:00
set directory ( __bobthefish_basename " $current_dir " )
2013-09-18 06:17:15 +00:00
end
2016-03-30 06:28:25 +00:00
echo -n $parent
2016-06-06 20:53:12 +00:00
set_color -b $segment_basename_color
2016-03-30 06:28:25 +00:00
echo -ns $directory ' '
2013-09-18 06:17:15 +00:00
end
2016-01-25 15:06:48 +00:00
function __bobthefish_finish_segments -S -d 'Close open prompt segments'
2017-12-24 03:39:26 +00:00
if [ - n " $__bobthefish_current_bg " ]
2016-06-06 20:53:12 +00:00
set_color normal
2014-05-14 19:37:52 +00:00
set_color $__bobthefish_current_bg
2017-06-17 15:25:47 +00:00
echo -ns $__bobthefish_right_black_arrow_glyph ' '
end
if [ " $theme_newline_cursor " = 'yes' ]
echo -ens "\n"
set_color $fish_color_autosuggestion
if [ " $theme_powerline_fonts " = "no" ]
echo -ns '> '
else
echo -ns " $__bobthefish_right_arrow_glyph "
2017-06-11 02:51:14 +00:00
end
2017-08-24 04:11:13 +00:00
else if [ " $theme_newline_cursor " = 'clean' ]
echo -ens "\n"
2013-09-18 06:17:15 +00:00
end
2016-02-04 07:10:57 +00:00
2016-04-04 15:36:11 +00:00
set_color normal
2017-02-01 13:13:31 +00:00
set __bobthefish_current_bg
2013-09-18 06:17:15 +00:00
end
2017-12-19 16:32:59 +00:00
# ==============================
# Status and input mode segments
# ==============================
function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a non-zero exit status, root user, and background jobs'
set -l nonzero
set -l superuser
set -l bg_jobs
# Last exit was nonzero
[ $last_status - ne 0 ]
and set nonzero $__bobthefish_nonzero_exit_glyph
2017-12-23 23:15:59 +00:00
# If superuser (uid == 0)
#
# Note that iff the current user is root and '/' is not writeable by root this
# will be wrong. But I can't think of a single reason that would happen, and
# this way is 99.5% faster to check it this way, so that's a tradeoff I'm
# willing to make.
[ - w / ]
and [ ( id - u) - eq 0 ]
2017-12-19 16:32:59 +00:00
and set superuser $__bobthefish_superuser_glyph
# Jobs display
2017-12-23 23:04:05 +00:00
jobs -p > /dev/null
2017-12-19 16:32:59 +00:00
and set bg_jobs $__bobthefish_bg_job_glyph
if [ " $nonzero " - o " $superuser " - o " $bg_jobs " ]
__bobthefish_start_segment $__color_initial_segment_exit
if [ " $nonzero " ]
set_color normal
set_color -b $__color_initial_segment_exit
if [ " $theme_show_exit_status " = 'yes' ]
echo -ns $last_status ' '
else
echo -n $__bobthefish_nonzero_exit_glyph
end
end
if [ " $superuser " ]
set_color normal
if [ - z " $FAKEROOTKEY " ]
set_color -b $__color_initial_segment_su
else
set_color -b $__color_initial_segment_exit
end
echo -n $__bobthefish_superuser_glyph
end
if [ " $bg_jobs " ]
set_color normal
set_color -b $__color_initial_segment_jobs
echo -n $__bobthefish_bg_job_glyph
end
end
end
function __bobthefish_prompt_vi -S -d 'Display vi mode'
[ " $theme_display_vi " != 'no' ] ; or return
[ " $fish_key_bindings " = 'fish_vi_key_bindings' \
-o " $fish_key_bindings " = 'hybrid_bindings' \
-o " $fish_key_bindings " = 'fish_hybrid_key_bindings' \
- o " $theme_display_vi " = 'yes' ] ; or return
switch $fish_bind_mode
case default
__bobthefish_start_segment $__color_vi_mode_default
echo -n 'N '
case insert
__bobthefish_start_segment $__color_vi_mode_insert
echo -n 'I '
2017-12-31 13:44:38 +00:00
case replace_one replace-one
2017-12-19 16:32:59 +00:00
__bobthefish_start_segment $__color_vi_mode_insert
echo -n 'R '
case visual
__bobthefish_start_segment $__color_vi_mode_visual
echo -n 'V '
end
end
# ==============================
# Container and VM segments
# ==============================
2013-09-18 06:17:15 +00:00
2016-01-25 15:06:48 +00:00
function __bobthefish_prompt_vagrant -S -d 'Display Vagrant status'
2016-02-19 18:06:52 +00:00
[ " $theme_display_vagrant " = 'yes' - a - f Vagrantfile ] ; or return
2016-08-25 19:18:10 +00:00
# .vagrant/machines/$machine/$provider/id
for file in .vagrant/machines/*/*/id
2017-12-23 13:07:56 +00:00
read -l id < " $file "
2016-08-25 19:18:10 +00:00
2017-12-23 13:07:56 +00:00
if [ - n " $id " ]
2016-08-25 19:18:10 +00:00
switch " $file "
case '*/virtualbox/id'
2016-08-22 19:35:20 +00:00
__bobthefish_prompt_vagrant_vbox $id
2016-08-25 19:18:10 +00:00
case '*/vmware_fusion/id'
2016-08-22 19:35:20 +00:00
__bobthefish_prompt_vagrant_vmware $id
2016-08-25 19:18:10 +00:00
case '*/parallels/id'
2016-08-22 19:35:20 +00:00
__bobthefish_prompt_vagrant_parallels $id
end
end
2016-02-19 07:14:13 +00:00
end
end
2016-08-22 19:35:20 +00:00
function __bobthefish_prompt_vagrant_vbox -S -a id -d 'Display VirtualBox Vagrant status'
2016-02-19 07:14:13 +00:00
set -l vagrant_status
2016-08-22 19:35:20 +00:00
set -l vm_status ( VBoxManage showvminfo --machinereadable $id ^ /dev/null | command grep 'VMState=' | tr -d '"' | cut -d '=' -f 2 )
switch " $vm_status "
case 'running'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_running_glyph "
case 'poweroff'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_poweroff_glyph "
case 'aborted'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_aborted_glyph "
case 'saved'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_saved_glyph "
case 'stopping'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_stopping_glyph "
case ''
set vagrant_status " $vagrant_status $__bobthefish_vagrant_unknown_glyph "
2016-02-19 07:14:13 +00:00
end
2016-03-30 06:28:25 +00:00
[ - z " $vagrant_status " ] ; and return
2016-02-19 07:14:13 +00:00
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_vagrant
2016-03-30 06:28:25 +00:00
echo -ns $vagrant_status ' '
2016-02-19 07:14:13 +00:00
end
2016-08-22 19:35:20 +00:00
function __bobthefish_prompt_vagrant_vmware -S -a id -d 'Display VMWare Vagrant status'
2016-02-19 07:14:13 +00:00
set -l vagrant_status
2016-08-22 19:35:20 +00:00
if [ ( pgrep - f " $id " ) ]
set vagrant_status " $vagrant_status $__bobthefish_vagrant_running_glyph "
else
set vagrant_status " $vagrant_status $__bobthefish_vagrant_poweroff_glyph "
2015-12-16 18:12:21 +00:00
end
2016-02-19 07:14:13 +00:00
[ - z " $vagrant_status " ] ; and return
2016-08-21 19:11:35 +00:00
__bobthefish_start_segment $__color_vagrant
echo -ns $vagrant_status ' '
end
function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant status'
set -l vagrant_status
2016-08-22 19:35:20 +00:00
set -l vm_status ( prlctl list $id -o status ^ /dev/null | command tail -1 )
switch " $vm_status "
case 'running'
2016-02-19 07:14:13 +00:00
set vagrant_status " $vagrant_status $__bobthefish_vagrant_running_glyph "
2016-08-22 19:35:20 +00:00
case 'stopped'
2016-02-19 07:14:13 +00:00
set vagrant_status " $vagrant_status $__bobthefish_vagrant_poweroff_glyph "
2016-08-22 19:35:20 +00:00
case 'paused'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_saved_glyph "
case 'suspended'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_saved_glyph "
case 'stopping'
set vagrant_status " $vagrant_status $__bobthefish_vagrant_stopping_glyph "
case ''
set vagrant_status " $vagrant_status $__bobthefish_vagrant_unknown_glyph "
2015-12-16 18:12:21 +00:00
end
2016-02-19 07:14:13 +00:00
[ - z " $vagrant_status " ] ; and return
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_vagrant
2016-03-30 06:28:25 +00:00
echo -ns $vagrant_status ' '
2015-12-16 18:12:21 +00:00
end
2017-12-19 16:32:59 +00:00
function __bobthefish_prompt_docker -S -d 'Display Docker machine name'
[ " $theme_display_docker_machine " = 'no' - o - z " $DOCKER_MACHINE_NAME " ] ; and return
__bobthefish_start_segment $__color_vagrant
echo -ns $DOCKER_MACHINE_NAME ' '
2016-06-01 13:50:14 +00:00
end
2017-08-08 07:46:20 +00:00
function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
2017-12-23 13:06:32 +00:00
[ " $theme_display_k8s_context " = 'no' ] ; and return
set -l config_paths " $HOME /.kube/config "
[ - n " $KUBECONFIG " ]
and set config_paths ( string split ':' " $KUBECONFIG " ) $config_paths
for file in $config_paths
[ - f " $file " ] ; or continue
while read -l key val
if [ " $key " = 'current-context:' ]
2018-01-10 14:38:55 +00:00
set -l context ( string trim -c '"\' ' -- $val )
[ - z " $context " ] ; and return
2017-12-23 13:06:32 +00:00
__bobthefish_start_segment $__color_k8s
2018-01-10 14:38:55 +00:00
echo -ns $context ' '
2017-12-23 13:06:32 +00:00
return
end
end < $file
end
2017-08-08 07:46:20 +00:00
end
2013-09-18 06:17:15 +00:00
2017-12-19 16:32:59 +00:00
# ==============================
# User / hostname info segments
# ==============================
2013-09-18 06:17:15 +00:00
2017-12-19 16:32:59 +00:00
function __bobthefish_prompt_user -S -d 'Display current user and hostname'
2017-12-19 16:08:05 +00:00
[ " $theme_display_user " = 'yes' - o - n " $SSH_CLIENT " - o \( - n " $default_user " - a " $USER " != " $default_user " \) ]
and set -l display_user
[ " $theme_display_hostname " = 'yes' - o - n " $SSH_CLIENT " ]
and set -l display_hostname
if set -q display_user
__bobthefish_start_segment $__color_username
echo -ns ( whoami )
2017-12-19 15:38:15 +00:00
end
2017-12-19 16:08:05 +00:00
if set -q display_hostname
set -l IFS .
hostname | read -l hostname __
if set -q display_user
# reset colors without starting a new segment...
# (so we can have a bold username and non-bold hostname)
set_color normal
set_color -b $__color_hostname [ 1 ] $__color_hostname [ 2 .. - 1 ]
echo -ns '@' $hostname
else
__bobthefish_start_segment $__color_hostname
echo -ns $hostname
end
2017-12-19 15:38:15 +00:00
end
2017-12-19 16:08:05 +00:00
set -q display_user
2018-01-03 21:23:57 +00:00
or set -q display_hostname
2017-12-19 16:08:05 +00:00
and echo -ns ' '
2013-09-18 06:17:15 +00:00
end
2017-12-19 16:32:59 +00:00
# ==============================
# Virtual environment segments
# ==============================
function __bobthefish_rvm_parse_ruby -S -a ruby_string scope -d 'Parse RVM Ruby string'
# Function arguments:
# - 'ruby-2.2.3@rails', 'jruby-1.7.19'...
# - 'default' or 'current'
set -l IFS @
echo " $ruby_string " | read __ruby __rvm_{ $scope } _ruby_gemset __
set IFS -
echo " $__ruby " | read __rvm_{ $scope } _ruby_interpreter __rvm_{ $scope } _ruby_version __
set -e __ruby
set -e __
end
function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM'
# More `sed`/`grep`/`cut` magic...
set -l __rvm_default_ruby ( grep GEM_HOME ~/.rvm/environments/default | sed -e "s/'//g" | sed -e 's/.*\///' )
set -l __rvm_current_ruby ( rvm-prompt i v g)
[ " $__rvm_default_ruby " = " $__rvm_current_ruby " ] ; and return
set -l __rvm_default_ruby_gemset
set -l __rvm_default_ruby_interpreter
set -l __rvm_default_ruby_version
set -l __rvm_current_ruby_gemset
set -l __rvm_current_ruby_interpreter
set -l __rvm_current_ruby_version
# Parse default and current Rubies to global variables
__bobthefish_rvm_parse_ruby $__rvm_default_ruby default
__bobthefish_rvm_parse_ruby $__rvm_current_ruby current
# Show unobtrusive RVM prompt
# If interpreter differs form default interpreter, show everything:
if [ " $__rvm_default_ruby_interpreter " != " $__rvm_current_ruby_interpreter " ]
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' ]
rvm-prompt v
else
rvm-prompt v g
end
# If gemset differs form default or 'global' gemset, just show it
else if [ " $__rvm_default_ruby_gemset " != " $__rvm_current_ruby_gemset " ]
rvm-prompt g
end
end
function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
[ " $theme_display_ruby " = 'no' ] ; and return
set -l ruby_version
if type -q rvm-prompt
set ruby_version ( __bobthefish_rvm_info )
else if type -q rbenv
set ruby_version ( rbenv version-name)
# Don't show global ruby version...
set -q RBENV_ROOT
or set -l RBENV_ROOT $HOME /.rbenv
[ - e " $RBENV_ROOT /version " ]
and read -l global_ruby_version < " $RBENV_ROOT /version "
[ " $global_ruby_version " ]
or set -l global_ruby_version system
[ " $ruby_version " = " $global_ruby_version " ] ; and return
else if type -q chruby
set ruby_version $RUBY_VERSION
2017-12-21 19:06:06 +00:00
else if type -q asdf
2017-12-24 19:51:22 +00:00
asdf current ruby ^ /dev/null | read -l asdf_ruby_version asdf_provenance
or return
2017-12-21 19:06:06 +00:00
2017-12-24 19:28:38 +00:00
# If asdf changes their ruby version provenance format, update this to match
[ " $asdf_provenance " = " (set by $HOME /.tool-versions) " ] ; and return
set ruby_version $asdf_ruby_version
2017-12-19 16:32:59 +00:00
end
[ - z " $ruby_version " ] ; and return
__bobthefish_start_segment $__color_rvm
echo -ns $__bobthefish_ruby_glyph $ruby_version ' '
end
function __bobthefish_virtualenv_python_version -S -d 'Get current Python version'
switch ( python --version ^ | tr '\n' ' ' )
case 'Python 2*PyPy*'
echo $__bobthefish_pypy_glyph
case 'Python 3*PyPy*'
echo -s $__bobthefish_pypy_glyph $__bobthefish_superscript_glyph [ 3 ]
case 'Python 2*'
echo $__bobthefish_superscript_glyph [ 2 ]
case 'Python 3*'
echo $__bobthefish_superscript_glyph [ 3 ]
end
end
function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself)"
[ " $theme_display_virtualenv " = 'no' - o - z " $VIRTUAL_ENV " ] ; and return
set -l version_glyph ( __bobthefish_virtualenv_python_version )
if [ " $version_glyph " ]
__bobthefish_start_segment $__color_virtualfish
echo -ns $__bobthefish_virtualenv_glyph $version_glyph ' '
end
echo -ns ( basename " $VIRTUAL_ENV " ) ' '
end
function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environment'
[ " $theme_display_virtualgo " = 'no' - o - z " $VIRTUALGO " ] ; and return
2017-12-19 20:30:52 +00:00
__bobthefish_start_segment $__color_virtualgo
2017-12-19 16:32:59 +00:00
echo -ns $__bobthefish_go_glyph
echo -ns ( basename " $VIRTUALGO " ) ' '
set_color normal
end
# ==============================
# VCS segments
# ==============================
2016-01-25 15:06:48 +00:00
function __bobthefish_prompt_hg -S -a current_dir -d 'Display the actual hg state'
2014-11-23 18:33:06 +00:00
set -l dirty ( command hg stat; or echo -n '*' )
2014-11-16 10:47:15 +00:00
set -l flags " $dirty "
2016-03-30 06:28:25 +00:00
[ " $flags " ]
and set flags ""
2014-11-16 10:47:15 +00:00
2016-06-06 20:53:12 +00:00
set -l flag_colors $__color_repo
2014-11-23 18:36:58 +00:00
if [ " $dirty " ]
2016-06-06 20:53:12 +00:00
set flag_colors $__color_repo_dirty
2014-11-16 10:47:15 +00:00
end
2015-10-14 03:40:44 +00:00
__bobthefish_path_segment $current_dir
2014-11-16 10:47:15 +00:00
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $flag_colors
2016-03-30 06:28:25 +00:00
echo -ns $__bobthefish_hg_glyph ' '
2014-11-18 02:40:30 +00:00
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $flag_colors
2016-03-30 06:28:25 +00:00
echo -ns ( __bobthefish_hg_branch ) $flags ' '
2014-11-16 10:47:15 +00:00
set_color normal
2015-10-14 03:40:44 +00:00
set -l project_pwd ( __bobthefish_project_pwd $current_dir )
2014-11-23 18:36:58 +00:00
if [ " $project_pwd " ]
if [ - w " $PWD " ]
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_path
2014-11-16 10:47:15 +00:00
else
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_path_nowrite
2014-11-16 10:47:15 +00:00
end
2016-03-30 06:28:25 +00:00
echo -ns $project_pwd ' '
2014-11-16 10:47:15 +00:00
end
end
2016-01-25 15:06:48 +00:00
function __bobthefish_prompt_git -S -a current_dir -d 'Display the actual git state'
2018-01-10 21:38:42 +00:00
set -l dirty ''
if [ " $theme_display_git_dirty " != 'no' ]
set -l show_dirty ( command git config --bool bash.showDirtyState ^ /dev/null)
if [ " $show_dirty " != 'false' ]
set dirty ( command git diff --no-ext-diff --quiet --exit-code ^ /dev/null; or echo -n " $__bobthefish_git_dirty_glyph " )
end
end
2017-07-10 07:04:40 +00:00
set -l staged ( command git diff --cached --no-ext-diff --quiet --exit-code ^ /dev/null; or echo -n " $__bobthefish_git_staged_glyph " )
2017-05-03 19:23:28 +00:00
set -l stashed ( command git rev-parse --verify --quiet refs/stash > /dev/null; and echo -n " $__bobthefish_git_stashed_glyph " )
2015-06-24 21:50:28 +00:00
set -l ahead ( __bobthefish_git_ahead )
2013-09-18 06:17:15 +00:00
2015-04-24 17:59:50 +00:00
set -l new ''
2018-01-10 21:38:42 +00:00
if [ " $theme_display_git_untracked " != 'no' ]
set -l show_untracked ( command git config --bool bash.showUntrackedFiles ^ /dev/null)
if [ " $show_untracked " != 'false' ]
set new ( command git ls-files --other --exclude-standard --directory --no-empty-directory ^ /dev/null)
if [ " $new " ]
set new " $__bobthefish_git_untracked_glyph "
end
2015-10-14 03:34:35 +00:00
end
2015-04-24 17:59:50 +00:00
end
2013-09-18 06:17:15 +00:00
2015-10-14 03:40:44 +00:00
set -l flags " $dirty $staged $stashed $ahead $new "
2016-03-30 06:28:25 +00:00
[ " $flags " ]
and set flags " $flags "
2013-09-18 06:17:15 +00:00
2016-06-06 20:53:12 +00:00
set -l flag_colors $__color_repo
2016-05-17 20:38:01 +00:00
if [ " $dirty " ]
2016-06-06 20:53:12 +00:00
set flag_colors $__color_repo_dirty
2016-05-17 20:38:01 +00:00
else if [ " $staged " ]
2016-06-06 20:53:12 +00:00
set flag_colors $__color_repo_staged
2013-09-18 06:17:15 +00:00
end
2015-06-24 21:50:28 +00:00
2015-10-14 03:40:44 +00:00
__bobthefish_path_segment $current_dir
2013-09-18 06:17:15 +00:00
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $flag_colors
2016-03-30 06:28:25 +00:00
echo -ns ( __bobthefish_git_branch ) $flags ' '
2013-09-18 06:17:15 +00:00
set_color normal
2016-03-30 23:57:34 +00:00
if [ " $theme_git_worktree_support " != 'yes' ]
set -l project_pwd ( __bobthefish_project_pwd $current_dir )
if [ " $project_pwd " ]
if [ - w " $PWD " ]
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_path
2016-03-30 23:57:34 +00:00
else
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_path_nowrite
2016-03-30 23:57:34 +00:00
end
echo -ns $project_pwd ' '
end
return
end
2017-12-24 03:39:10 +00:00
set -l project_pwd ( command git rev-parse --show-prefix ^ /dev/null | string trim --right --chars = /)
2016-03-30 23:57:34 +00:00
set -l work_dir ( command git rev-parse --show-toplevel ^ /dev/null)
# only show work dir if it's a parent…
if [ " $work_dir " ]
switch $PWD /
case $work_dir /\*
2017-02-28 15:09:38 +00:00
string match " $current_dir * " $work_dir > /dev/null
and set work_dir ( string sub -s ( math 1 + ( string length $current_dir ) ) $work_dir )
2016-03-30 23:57:34 +00:00
case \*
set -e work_dir
end
end
if [ " $project_pwd " - o " $work_dir " ]
2016-06-06 20:53:12 +00:00
set -l colors $__color_path
2016-03-30 23:57:34 +00:00
if not [ - w " $PWD " ]
2016-06-06 20:53:12 +00:00
set colors $__color_path_nowrite
2016-03-30 23:57:34 +00:00
end
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $colors
2016-03-30 23:57:34 +00:00
# handle work_dir != project dir
if [ " $work_dir " ]
2017-12-24 02:26:29 +00:00
set -l work_parent ( __bobthefish_dirname $work_dir )
2016-03-30 23:57:34 +00:00
if [ " $work_parent " ]
echo -n " $work_parent / "
end
2017-02-01 13:13:31 +00:00
set_color normal
set_color -b $__color_repo_work_tree
2017-12-24 02:26:29 +00:00
echo -n ( __bobthefish_basename $work_dir )
2017-02-01 13:13:31 +00:00
set_color normal
set_color -b $colors
2016-03-30 23:57:34 +00:00
[ " $project_pwd " ]
and echo -n '/'
2013-09-18 06:17:15 +00:00
end
2016-03-30 06:28:25 +00:00
echo -ns $project_pwd ' '
2016-03-30 23:57:34 +00:00
else
2017-01-30 04:02:01 +00:00
set project_pwd $PWD
2017-02-28 15:09:38 +00:00
string match " $current_dir * " $project_pwd > /dev/null
and set project_pwd ( string sub -s ( math 1 + ( string length $current_dir ) ) $project_pwd )
2017-12-24 03:39:10 +00:00
set project_pwd ( string trim --left --chars = / -- $project_pwd )
2017-01-30 04:02:01 +00:00
2016-03-30 23:57:34 +00:00
if [ " $project_pwd " ]
2017-02-28 15:09:38 +00:00
set -l colors $__color_path
2016-03-30 23:57:34 +00:00
if not [ - w " $PWD " ]
2017-02-28 15:09:38 +00:00
set colors $__color_path_nowrite
2016-03-30 23:57:34 +00:00
end
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $colors
2016-03-30 23:57:34 +00:00
echo -ns $project_pwd ' '
end
2013-09-18 06:17:15 +00:00
end
end
2016-01-25 15:06:48 +00:00
function __bobthefish_prompt_dir -S -d 'Display a shortened form of the current directory'
2013-09-18 06:17:15 +00:00
__bobthefish_path_segment " $PWD "
end
2014-11-20 20:58:23 +00:00
2017-12-19 16:32:59 +00:00
# ==============================
2016-06-06 20:53:12 +00:00
# Debugging functions
2017-12-19 16:32:59 +00:00
# ==============================
2016-06-06 20:53:12 +00:00
function __bobthefish_display_colors -d 'Print example prompts using the current color scheme'
2016-06-07 05:30:18 +00:00
set -g __bobthefish_display_colors
2016-06-06 20:53:12 +00:00
end
function __bobthefish_maybe_display_colors -S
2017-12-19 20:33:50 +00:00
set -q __bobthefish_display_colors ; or return
2016-06-07 05:30:18 +00:00
set -e __bobthefish_display_colors
2016-06-06 20:53:12 +00:00
echo
set_color normal
__bobthefish_start_segment $__color_initial_segment_exit
echo -n exit '! '
set_color -b $__color_initial_segment_su
echo -n su '$ '
set_color -b $__color_initial_segment_jobs
echo -n jobs '% '
__bobthefish_finish_segments
set_color normal
2017-12-19 20:33:50 +00:00
echo -n "(<- initial_segment)"
2016-06-06 20:53:12 +00:00
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
echo -n /color/path/
set_color -b $__color_path_basename
echo -ns basename ' '
__bobthefish_start_segment $__color_repo
2017-12-19 20:33:50 +00:00
echo -n " $__bobthefish_branch_glyph repo $__bobthefish_git_stashed_glyph "
2016-06-06 20:53:12 +00:00
__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
2017-12-19 20:33:50 +00:00
echo -n " $__bobthefish_tag_glyph repo_dirty $__bobthefish_git_dirty_glyph "
2016-06-06 20:53:12 +00:00
__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
2017-12-19 20:33:50 +00:00
echo -n " $__bobthefish_detached_glyph repo_staged $__bobthefish_git_staged_glyph "
2016-06-06 20:53:12 +00:00
__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
2017-12-19 20:33:50 +00:00
echo -ns $__bobthefish_vagrant_running_glyph ' ' vagrant ' '
2016-06-06 20:53:12 +00:00
__bobthefish_finish_segments
echo
__bobthefish_start_segment $__color_username
2017-12-19 20:33:50 +00:00
echo -n username
set_color normal
set_color -b $__color_hostname [ 1 ] $__color_hostname [ 2 .. - 1 ]
echo -ns @hostname ' '
2017-12-19 15:38:15 +00:00
__bobthefish_finish_segments
echo
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_rvm
2017-12-19 20:33:50 +00:00
echo -ns $__bobthefish_ruby_glyph rvm ' '
2016-06-06 20:53:12 +00:00
__bobthefish_finish_segments
2017-12-19 20:33:50 +00:00
2016-06-06 20:53:12 +00:00
__bobthefish_start_segment $__color_virtualfish
2017-12-19 20:33:50 +00:00
echo -ns $__bobthefish_virtualenv_glyph virtualfish ' '
__bobthefish_finish_segments
__bobthefish_start_segment $__color_virtualgo
echo -ns $__bobthefish_go_glyph virtualgo ' '
2016-06-06 20:53:12 +00:00
__bobthefish_finish_segments
2017-12-19 20:33:50 +00:00
2016-06-06 20:53:12 +00:00
echo -e "\n"
end
2017-12-19 16:32:59 +00:00
# ==============================
2013-09-18 06:17:15 +00:00
# Apply theme
2017-12-19 16:32:59 +00:00
# ==============================
2013-09-18 06:17:15 +00:00
2013-10-16 01:41:19 +00:00
function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
2016-02-04 07:13:51 +00:00
# Save the last status for later (do this before the `set` calls below)
2016-02-04 07:06:15 +00:00
set -l last_status $status
2016-01-25 15:06:48 +00:00
# Powerline glyphs
2016-05-16 01:18:28 +00:00
set -l __bobthefish_branch_glyph \u E0A0
set -l __bobthefish_right_black_arrow_glyph \u E0B0
set -l __bobthefish_right_arrow_glyph \u E0B1
set -l __bobthefish_left_black_arrow_glyph \u E0B2
set -l __bobthefish_left_arrow_glyph \u E0B3
2016-01-25 15:06:48 +00:00
# Additional glyphs
set -l __bobthefish_detached_glyph \u 27A6
2016-08-25 15:06:23 +00:00
set -l __bobthefish_tag_glyph \u 2302
2016-01-25 15:06:48 +00:00
set -l __bobthefish_nonzero_exit_glyph '! '
set -l __bobthefish_superuser_glyph '$ '
set -l __bobthefish_bg_job_glyph '% '
set -l __bobthefish_hg_glyph \u 263F
# Python glyphs
set -l __bobthefish_superscript_glyph \u 00B9 \u 00B2 \u 00B3
set -l __bobthefish_virtualenv_glyph \u 25F0
set -l __bobthefish_pypy_glyph \u 1D56
2016-02-19 06:00:31 +00:00
set -l __bobthefish_ruby_glyph ''
2017-12-19 20:30:52 +00:00
set -l __bobthefish_go_glyph ''
2016-02-19 06:00:31 +00:00
2016-01-25 15:06:48 +00:00
# Vagrant glyphs
set -l __bobthefish_vagrant_running_glyph \u 2191 # ↑ 'running'
set -l __bobthefish_vagrant_poweroff_glyph \u 2193 # ↓ 'poweroff'
set -l __bobthefish_vagrant_aborted_glyph \u 2715 # ✕ 'aborted'
set -l __bobthefish_vagrant_saved_glyph \u 21E1 # ⇡ 'saved'
2016-02-01 20:24:49 +00:00
set -l __bobthefish_vagrant_stopping_glyph \u 21E3 # ⇣ 'stopping'
2016-01-25 15:06:48 +00:00
set -l __bobthefish_vagrant_unknown_glyph '!' # strange cases
2017-05-03 19:23:28 +00:00
# Git glyphs
set -l __bobthefish_git_dirty_glyph '*'
set -l __bobthefish_git_staged_glyph '~'
set -l __bobthefish_git_stashed_glyph '$'
set -l __bobthefish_git_untracked_glyph '…'
set -l __bobthefish_git_ahead_glyph \u 2191 # '↑'
set -l __bobthefish_git_behind_glyph \u 2193 # '↓'
set -l __bobthefish_git_plus_glyph '+'
set -l __bobthefish_git_minus_glyph '-'
set -l __bobthefish_git_plus_minus_glyph '±'
2016-08-25 14:59:01 +00:00
# Disable Powerline fonts
if [ " $theme_powerline_fonts " = "no" ]
set __bobthefish_branch_glyph \u 2387
set __bobthefish_right_black_arrow_glyph ''
set __bobthefish_right_arrow_glyph ''
set __bobthefish_left_black_arrow_glyph ''
set __bobthefish_left_arrow_glyph ''
end
# Use prettier Nerd Fonts glyphs
if [ " $theme_nerd_fonts " = "yes" ]
set __bobthefish_branch_glyph \u F418
set __bobthefish_detached_glyph \u F417
set __bobthefish_tag_glyph \u F412
set __bobthefish_virtualenv_glyph \u E73C ' '
set __bobthefish_ruby_glyph \u E791 ' '
2017-12-19 20:30:52 +00:00
set __bobthefish_go_glyph \u E626 ' '
2016-08-25 14:59:01 +00:00
set __bobthefish_vagrant_running_glyph \u F431 # ↑ 'running'
set __bobthefish_vagrant_poweroff_glyph \u F433 # ↓ 'poweroff'
set __bobthefish_vagrant_aborted_glyph \u F468 # ✕ 'aborted'
set __bobthefish_vagrant_unknown_glyph \u F421 # strange cases
2017-05-18 21:10:24 +00:00
2017-08-02 22:38:17 +00:00
set __bobthefish_git_dirty_glyph \u F448 '' # nf-oct-pencil
set __bobthefish_git_staged_glyph \u F0C7 '' # nf-fa-save
2017-05-18 21:10:24 +00:00
set __bobthefish_git_stashed_glyph \u F0C6 '' # nf-fa-paperclip
2017-08-02 22:38:17 +00:00
set __bobthefish_git_untracked_glyph \u F128 '' # nf-fa-question
2017-09-07 23:53:17 +00:00
# set __bobthefish_git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h
2017-05-18 21:10:24 +00:00
set __bobthefish_git_ahead_glyph \u F47B # nf-oct-chevron_up
set __bobthefish_git_behind_glyph \u F47C # nf-oct-chevron_down
set __bobthefish_git_plus_glyph \u F0DE # fa-sort-asc
set __bobthefish_git_minus_glyph \u F0DD # fa-sort-desc
set __bobthefish_git_plus_minus_glyph \u F0DC # fa-sort
2016-08-25 14:59:01 +00:00
end
2017-05-03 19:23:28 +00:00
# Avoid ambiguous glyphs
if [ " $theme_avoid_ambiguous_glyphs " = "yes" ]
set __bobthefish_git_untracked_glyph '...'
end
2016-08-25 14:59:01 +00:00
2016-01-25 15:06:48 +00:00
# Colors
2016-06-06 20:53:12 +00:00
switch " $theme_color_scheme "
case 'user'
# Do not set any variables in this section.
# If you want to create your own color scheme, set `theme_color_scheme` to
2016-06-07 17:48:40 +00:00
# `user` and define the `__color_*` variables listed below in your fish
# startup file (`$OMF_CONFIG/init.fish`, or similar).
2016-06-06 20:53:12 +00:00
# The value for each variable is an argument to pass to `set_color -b`.
2016-06-07 17:48:40 +00:00
# You can copy the commented code below as a base for your custom colors.
# Use `__bobthefish_display_colors` at the command line to easily see what
# these variables are used for.
# See the built-in color schemes below for more examples.
# # Example bobthefish color scheme:
# set -g theme_color_scheme user
#
# set -g __color_initial_segment_exit ffffff ce000f --bold
# set -g __color_initial_segment_su ffffff 189303 --bold
# set -g __color_initial_segment_jobs ffffff 255e87 --bold
#
# set -g __color_path 333333 999999
# set -g __color_path_basename 333333 ffffff --bold
# set -g __color_path_nowrite 660000 cc9999
# set -g __color_path_nowrite_basename 660000 cc9999 --bold
#
# set -g __color_repo addc10 0c4801
2017-02-28 15:09:38 +00:00
# set -g __color_repo_work_tree 333333 ffffff --bold
2016-06-07 17:48:40 +00:00
# set -g __color_repo_dirty ce000f ffffff
# set -g __color_repo_staged f6b117 3a2a03
#
# set -g __color_vi_mode_default 999999 333333 --bold
# set -g __color_vi_mode_insert 189303 333333 --bold
# set -g __color_vi_mode_visual f6b117 3a2a03 --bold
2016-06-06 20:53:12 +00:00
#
2016-06-07 17:48:40 +00:00
# set -g __color_vagrant 48b4fb ffffff --bold
2017-12-19 16:08:00 +00:00
# set -g __color_username cccccc 255e87 --bold
2017-12-19 15:38:15 +00:00
# set -g __color_hostname cccccc 255e87
2016-06-07 17:48:40 +00:00
# set -g __color_rvm af0000 cccccc --bold
# set -g __color_virtualfish 005faf cccccc --bold
2017-12-19 20:30:52 +00:00
# set -g __color_virtualgo 005faf cccccc --bold
2016-06-06 20:53:12 +00:00
case 'terminal' 'terminal-dark*'
set -l colorfg black
[ $theme_color_scheme = 'terminal-dark-white' ] ; and set colorfg white
set __color_initial_segment_exit white red --bold
set __color_initial_segment_su white green --bold
set __color_initial_segment_jobs white blue --bold
set __color_path black white
set __color_path_basename black white --bold
set __color_path_nowrite magenta $colorfg
set __color_path_nowrite_basename magenta $colorfg --bold
set __color_repo green $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree black $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty brred $colorfg
set __color_repo_staged yellow $colorfg
set __color_vi_mode_default brblue $colorfg --bold
set __color_vi_mode_insert brgreen $colorfg --bold
set __color_vi_mode_visual bryellow $colorfg --bold
set __color_vagrant brcyan $colorfg
2017-08-08 07:46:20 +00:00
set __color_k8s magenta white --bold
2017-12-19 16:08:00 +00:00
set __color_username white black --bold
2017-12-19 15:38:15 +00:00
set __color_hostname white black
2016-06-06 20:53:12 +00:00
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo brblue $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'terminal-light*'
set -l colorfg white
[ $theme_color_scheme = 'terminal-light-black' ] ; and set colorfg black
set __color_initial_segment_exit black red --bold
set __color_initial_segment_su black green --bold
set __color_initial_segment_jobs black blue --bold
set __color_path white black
set __color_path_basename white black --bold
set __color_path_nowrite magenta $colorfg
set __color_path_nowrite_basename magenta $colorfg --bold
set __color_repo green $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree white $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty brred $colorfg
set __color_repo_staged yellow $colorfg
set __color_vi_mode_default brblue $colorfg --bold
set __color_vi_mode_insert brgreen $colorfg --bold
set __color_vi_mode_visual bryellow $colorfg --bold
set __color_vagrant brcyan $colorfg
2017-08-08 07:46:20 +00:00
set __color_k8s magenta white --bold
2017-12-19 16:08:00 +00:00
set __color_username black white --bold
2017-12-19 15:38:15 +00:00
set __color_hostname black white
2016-06-06 20:53:12 +00:00
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo brblue $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'terminal2' 'terminal2-dark*'
set -l colorfg black
[ $theme_color_scheme = 'terminal2-dark-white' ] ; and set colorfg white
set __color_initial_segment_exit grey red --bold
set __color_initial_segment_su grey green --bold
set __color_initial_segment_jobs grey blue --bold
set __color_path brgrey white
set __color_path_basename brgrey white --bold
set __color_path_nowrite magenta $colorfg
set __color_path_nowrite_basename magenta $colorfg --bold
set __color_repo green $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree brgrey $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty brred $colorfg
set __color_repo_staged yellow $colorfg
set __color_vi_mode_default brblue $colorfg --bold
set __color_vi_mode_insert brgreen $colorfg --bold
set __color_vi_mode_visual bryellow $colorfg --bold
set __color_vagrant brcyan $colorfg
2017-08-08 07:46:20 +00:00
set __color_k8s magenta white --bold
2017-12-19 16:08:00 +00:00
set __color_username brgrey white --bold
2017-12-19 15:38:15 +00:00
set __color_hostname brgrey white
2016-06-06 20:53:12 +00:00
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo brblue $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'terminal2-light*'
set -l colorfg white
[ $theme_color_scheme = 'terminal2-light-black' ] ; and set colorfg black
set __color_initial_segment_exit brgrey red --bold
set __color_initial_segment_su brgrey green --bold
set __color_initial_segment_jobs brgrey blue --bold
set __color_path grey black
set __color_path_basename grey black --bold
set __color_path_nowrite magenta $colorfg
set __color_path_nowrite_basename magenta $colorfg --bold
set __color_repo green $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree grey $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty brred $colorfg
set __color_repo_staged yellow $colorfg
set __color_vi_mode_default brblue $colorfg --bold
set __color_vi_mode_insert brgreen $colorfg --bold
set __color_vi_mode_visual bryellow $colorfg --bold
set __color_vagrant brcyan $colorfg
2017-08-08 07:46:20 +00:00
set __color_k8s magenta white --bold
2017-12-19 16:08:00 +00:00
set __color_username grey black --bold
2017-12-19 15:38:15 +00:00
set __color_hostname grey black
2016-06-06 20:53:12 +00:00
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo brblue $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'zenburn'
set -l grey 333333 # a bit darker than normal zenburn grey
set -l red CC9393
set -l green 7F9F7F
set -l yellow E3CEAB
set -l orange DFAF8F
set -l blue 8CD0D3
set -l white DCDCCC
set __color_initial_segment_exit $white $red --bold
set __color_initial_segment_su $white $green --bold
set __color_initial_segment_jobs $white $blue --bold
set __color_path $grey $white
set __color_path_basename $grey $white --bold
2016-06-07 04:56:14 +00:00
set __color_path_nowrite $grey $red
set __color_path_nowrite_basename $grey $red --bold
2016-06-06 20:53:12 +00:00
set __color_repo $green $grey
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree $grey $grey --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty $red $grey
set __color_repo_staged $yellow $grey
set __color_vi_mode_default $grey $yellow --bold
set __color_vi_mode_insert $green $white --bold
set __color_vi_mode_visual $yellow $grey --bold
set __color_vagrant $blue $green --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $green $white --bold
2017-12-19 16:08:00 +00:00
set __color_username $grey $blue --bold
2017-12-19 15:38:15 +00:00
set __color_hostname $grey $blue
2016-06-06 20:53:12 +00:00
set __color_rvm $red $grey --bold
set __color_virtualfish $blue $grey --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $blue $grey --bold
2016-06-06 20:53:12 +00:00
case 'base16-light'
set -l base00 181818
set -l base01 282828
set -l base02 383838
set -l base03 585858
set -l base04 b8b8b8
set -l base05 d8d8d8
set -l base06 e8e8e8
set -l base07 f8f8f8
set -l base08 ab4642 # red
set -l base09 dc9656 # orange
set -l base0A f7ca88 # yellow
set -l base0B a1b56c # green
set -l base0C 86c1b9 # cyan
set -l base0D 7cafc2 # blue
set -l base0E ba8baf # violet
set -l base0F a16946 # brown
set -l colorfg $base00
set __color_initial_segment_exit $base02 $base08 --bold
set __color_initial_segment_su $base02 $base0B --bold
set __color_initial_segment_jobs $base02 $base0D --bold
2016-06-07 04:56:14 +00:00
set __color_path $base06 $base02
set __color_path_basename $base06 $base01 --bold
set __color_path_nowrite $base06 $base08
set __color_path_nowrite_basename $base06 $base08 --bold
2016-06-06 20:53:12 +00:00
set __color_repo $base0B $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree $base06 $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty $base08 $colorfg
set __color_repo_staged $base09 $colorfg
2016-06-07 04:56:14 +00:00
set __color_vi_mode_default $base04 $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_vi_mode_insert $base0B $colorfg --bold
set __color_vi_mode_visual $base09 $colorfg --bold
set __color_vagrant $base0C $colorfg --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $base06 $colorfg --bold
2017-12-19 16:08:00 +00:00
set __color_username $base02 $base0D --bold
2017-12-19 15:38:15 +00:00
set __color_hostname $base02 $base0D
2016-06-06 20:53:12 +00:00
set __color_rvm $base08 $colorfg --bold
set __color_virtualfish $base0D $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $base0D $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'base16' 'base16-dark'
set -l base00 181818
set -l base01 282828
set -l base02 383838
set -l base03 585858
set -l base04 b8b8b8
set -l base05 d8d8d8
set -l base06 e8e8e8
set -l base07 f8f8f8
set -l base08 ab4642 # red
set -l base09 dc9656 # orange
set -l base0A f7ca88 # yellow
set -l base0B a1b56c # green
set -l base0C 86c1b9 # cyan
set -l base0D 7cafc2 # blue
set -l base0E ba8baf # violet
set -l base0F a16946 # brown
set -l colorfg $base07
set __color_initial_segment_exit $base05 $base08 --bold
set __color_initial_segment_su $base05 $base0B --bold
set __color_initial_segment_jobs $base05 $base0D --bold
set __color_path $base02 $base05
set __color_path_basename $base02 $base06 --bold
2016-06-07 04:56:14 +00:00
set __color_path_nowrite $base02 $base08
set __color_path_nowrite_basename $base02 $base08 --bold
2016-06-06 20:53:12 +00:00
set __color_repo $base0B $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree $base02 $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty $base08 $colorfg
set __color_repo_staged $base09 $colorfg
set __color_vi_mode_default $base03 $colorfg --bold
set __color_vi_mode_insert $base0B $colorfg --bold
set __color_vi_mode_visual $base09 $colorfg --bold
set __color_vagrant $base0C $colorfg --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $base0B $colorfg --bold
2017-12-19 16:08:00 +00:00
set __color_username $base02 $base0D --bold
2017-12-19 15:38:15 +00:00
set __color_hostname $base02 $base0D
2016-06-06 20:53:12 +00:00
set __color_rvm $base08 $colorfg --bold
set __color_virtualfish $base0D $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $base0D $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'solarized-light'
set -l base03 002b36
set -l base02 073642
set -l base01 586e75
set -l base00 657b83
set -l base0 839496
set -l base1 93a1a1
set -l base2 eee8d5
set -l base3 fdf6e3
set -l yellow b58900
set -l orange cb4b16
set -l red dc322f
set -l magenta d33682
set -l violet 6c71c4
set -l blue 268bd2
set -l cyan 2aa198
set -l green 859900
set colorfg $base03
set __color_initial_segment_exit $base02 $red --bold
set __color_initial_segment_su $base02 $green --bold
set __color_initial_segment_jobs $base02 $blue --bold
set __color_path $base2 $base00
set __color_path_basename $base2 $base01 --bold
set __color_path_nowrite $base2 $orange
set __color_path_nowrite_basename $base2 $orange --bold
set __color_repo $green $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree $base2 $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty $red $colorfg
set __color_repo_staged $yellow $colorfg
set __color_vi_mode_default $blue $colorfg --bold
set __color_vi_mode_insert $green $colorfg --bold
set __color_vi_mode_visual $yellow $colorfg --bold
set __color_vagrant $violet $colorfg --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $green $colorfg --bold
2017-12-19 16:08:00 +00:00
set __color_username $base2 $blue --bold
2017-12-19 15:38:15 +00:00
set __color_hostname $base2 $blue
2016-06-06 20:53:12 +00:00
set __color_rvm $red $colorfg --bold
set __color_virtualfish $cyan $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $cyan $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'solarized' 'solarized-dark'
set -l base03 002b36
set -l base02 073642
set -l base01 586e75
set -l base00 657b83
set -l base0 839496
set -l base1 93a1a1
set -l base2 eee8d5
set -l base3 fdf6e3
set -l yellow b58900
set -l orange cb4b16
set -l red dc322f
set -l magenta d33682
set -l violet 6c71c4
set -l blue 268bd2
set -l cyan 2aa198
set -l green 859900
set colorfg $base3
set __color_initial_segment_exit $base2 $red --bold
set __color_initial_segment_su $base2 $green --bold
set __color_initial_segment_jobs $base2 $blue --bold
set __color_path $base02 $base0
set __color_path_basename $base02 $base1 --bold
set __color_path_nowrite $base02 $orange
set __color_path_nowrite_basename $base02 $orange --bold
set __color_repo $green $colorfg
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree $base02 $colorfg --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty $red $colorfg
set __color_repo_staged $yellow $colorfg
set __color_vi_mode_default $blue $colorfg --bold
set __color_vi_mode_insert $green $colorfg --bold
set __color_vi_mode_visual $yellow $colorfg --bold
set __color_vagrant $violet $colorfg --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $green $colorfg --bold
2017-12-19 16:08:00 +00:00
set __color_username $base02 $blue --bold
2017-12-19 15:38:15 +00:00
set __color_hostname $base02 $blue
2016-06-06 20:53:12 +00:00
set __color_rvm $red $colorfg --bold
set __color_virtualfish $cyan $colorfg --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $cyan $colorfg --bold
2016-06-06 20:53:12 +00:00
case 'light'
# light medium dark
# ------ ------ ------
set -l red cc9999 ce000f 660000
set -l green addc10 189303 0c4801
set -l blue 48b4fb 005faf 255e87
set -l orange f6b117 unused 3a2a03
set -l brown bf5e00 803f00 4d2600
set -l grey cccccc 999999 333333
set -l white ffffff
set -l black 000000
set -l ruby_red af0000
set __color_initial_segment_exit $grey [ 3 ] $red [ 2 ] --bold
set __color_initial_segment_su $grey [ 3 ] $green [ 2 ] --bold
set __color_initial_segment_jobs $grey [ 3 ] $blue [ 3 ] --bold
set __color_path $grey [ 1 ] $grey [ 2 ]
set __color_path_basename $grey [ 1 ] $grey [ 3 ] --bold
set __color_path_nowrite $red [ 1 ] $red [ 3 ]
set __color_path_nowrite_basename $red [ 1 ] $red [ 3 ] --bold
set __color_repo $green [ 1 ] $green [ 3 ]
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree $grey [ 1 ] $white --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty $red [ 2 ] $white
set __color_repo_staged $orange [ 1 ] $orange [ 3 ]
set __color_vi_mode_default $grey [ 2 ] $grey [ 3 ] --bold
set __color_vi_mode_insert $green [ 2 ] $grey [ 3 ] --bold
set __color_vi_mode_visual $orange [ 1 ] $orange [ 3 ] --bold
set __color_vagrant $blue [ 1 ] $white --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $green [ 1 ] $colorfg --bold
2017-12-19 16:08:00 +00:00
set __color_username $grey [ 1 ] $blue [ 3 ] --bold
2017-12-19 15:38:15 +00:00
set __color_hostname $grey [ 1 ] $blue [ 3 ]
2016-06-06 20:53:12 +00:00
set __color_rvm $ruby_red $grey [ 1 ] --bold
set __color_virtualfish $blue [ 2 ] $grey [ 1 ] --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $blue [ 2 ] $grey [ 1 ] --bold
2016-06-06 20:53:12 +00:00
2016-08-22 01:40:15 +00:00
case 'gruvbox'
# light medium dark darkest
# ------ ------ ------ -------
set -l red fb4934 cc241d
set -l green b8bb26 98971a
set -l yellow fabd2f d79921
set -l aqua 8ec07c 689d6a
set -l blue 83a598 458588
set -l grey cccccc 999999 333333
set -l fg fbf1c7 ebdbb2 d5c4a1 a89984
set -l bg 504945 282828
2017-12-19 20:21:28 +00:00
set __color_initial_segment_exit $fg [ 1 ] $red [ 2 ] --bold
set __color_initial_segment_su $fg [ 1 ] $green [ 2 ] --bold
set __color_initial_segment_jobs $fg [ 1 ] $aqua [ 2 ] --bold
set __color_path $bg [ 1 ] $fg [ 2 ]
set __color_path_basename $bg [ 1 ] $fg [ 2 ] --bold
set __color_path_nowrite $red [ 1 ] $fg [ 2 ]
set __color_path_nowrite_basename $red [ 1 ] $fg [ 2 ] --bold
set __color_repo $green [ 2 ] $bg [ 1 ]
set __color_repo_work_tree $bg [ 1 ] $fg [ 2 ] --bold
set __color_repo_dirty $red [ 2 ] $fg [ 2 ]
set __color_repo_staged $yellow [ 1 ] $bg [ 1 ]
set __color_vi_mode_default $fg [ 4 ] $bg [ 2 ] --bold
set __color_vi_mode_insert $blue [ 1 ] $bg [ 2 ] --bold
set __color_vi_mode_visual $yellow [ 1 ] $bg [ 2 ] --bold
set __color_vagrant $blue [ 2 ] $fg [ 2 ] --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $green [ 2 ] $fg [ 2 ] --bold
2017-12-19 20:21:28 +00:00
set __color_username $fg [ 3 ] $blue [ 2 ] --bold
set __color_hostname $fg [ 3 ] $blue [ 2 ]
set __color_rvm $red [ 2 ] $fg [ 2 ] --bold
set __color_virtualfish $blue [ 2 ] $fg [ 2 ] --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $blue [ 2 ] $fg [ 2 ] --bold
2016-08-22 01:40:15 +00:00
2016-06-06 20:53:12 +00:00
case '*' # default dark theme
# light medium dark
# ------ ------ ------
set -l red cc9999 ce000f 660000
set -l green addc10 189303 0c4801
set -l blue 48b4fb 005faf 255e87
set -l orange f6b117 unused 3a2a03
set -l brown bf5e00 803f00 4d2600
set -l grey cccccc 999999 333333
set -l white ffffff
set -l black 000000
set -l ruby_red af0000
set __color_initial_segment_exit $white $red [ 2 ] --bold
set __color_initial_segment_su $white $green [ 2 ] --bold
set __color_initial_segment_jobs $white $blue [ 3 ] --bold
set __color_path $grey [ 3 ] $grey [ 2 ]
set __color_path_basename $grey [ 3 ] $white --bold
set __color_path_nowrite $red [ 3 ] $red [ 1 ]
set __color_path_nowrite_basename $red [ 3 ] $red [ 1 ] --bold
set __color_repo $green [ 1 ] $green [ 3 ]
2017-02-28 15:09:38 +00:00
set __color_repo_work_tree $grey [ 3 ] $white --bold
2016-06-06 20:53:12 +00:00
set __color_repo_dirty $red [ 2 ] $white
set __color_repo_staged $orange [ 1 ] $orange [ 3 ]
set __color_vi_mode_default $grey [ 2 ] $grey [ 3 ] --bold
set __color_vi_mode_insert $green [ 2 ] $grey [ 3 ] --bold
set __color_vi_mode_visual $orange [ 1 ] $orange [ 3 ] --bold
set __color_vagrant $blue [ 1 ] $white --bold
2017-08-08 07:46:20 +00:00
set __color_k8s $green [ 2 ] $white --bold
2017-12-19 16:08:00 +00:00
set __color_username $grey [ 1 ] $blue [ 3 ] --bold
2017-12-19 15:38:15 +00:00
set __color_hostname $grey [ 1 ] $blue [ 3 ]
2016-06-06 20:53:12 +00:00
set __color_rvm $ruby_red $grey [ 1 ] --bold
set __color_virtualfish $blue [ 2 ] $grey [ 1 ] --bold
2017-12-19 20:30:52 +00:00
set __color_virtualgo $blue [ 2 ] $grey [ 1 ] --bold
2016-06-06 20:53:12 +00:00
end
2016-01-25 15:06:48 +00:00
2016-02-04 07:10:57 +00:00
# Start each line with a blank slate
set -l __bobthefish_current_bg
2017-12-19 16:32:59 +00:00
# Internal: used for testing color schemes
2016-06-06 20:53:12 +00:00
__bobthefish_maybe_display_colors
2017-12-19 16:32:59 +00:00
# Status flags and input mode
2016-02-04 07:06:15 +00:00
__bobthefish_prompt_status $last_status
2015-11-20 14:54:11 +00:00
__bobthefish_prompt_vi
2017-12-19 16:32:59 +00:00
# Containers and VMs
2015-12-16 18:12:21 +00:00
__bobthefish_prompt_vagrant
2016-06-01 13:50:14 +00:00
__bobthefish_prompt_docker
2017-08-08 07:46:20 +00:00
__bobthefish_prompt_k8s_context
2017-12-19 16:32:59 +00:00
# User / hostname info
2013-09-18 06:17:15 +00:00
__bobthefish_prompt_user
2017-12-19 16:32:59 +00:00
# Virtual environments
2014-11-23 17:34:59 +00:00
__bobthefish_prompt_rubies
2014-11-22 08:10:45 +00:00
__bobthefish_prompt_virtualfish
2017-11-02 16:06:56 +00:00
__bobthefish_prompt_virtualgo
2014-11-22 17:32:10 +00:00
2017-12-19 16:32:59 +00:00
# VCS
2014-11-22 17:32:10 +00:00
set -l git_root ( __bobthefish_git_project_dir )
set -l hg_root ( __bobthefish_hg_project_dir )
2016-03-30 23:13:39 +00:00
if [ " $git_root " - a " $hg_root " ]
# only show the closest parent
switch $git_root
case $hg_root \*
__bobthefish_prompt_git $git_root
case \*
__bobthefish_prompt_hg $hg_root
end
2014-11-23 18:36:58 +00:00
else if [ " $git_root " ]
2014-11-22 17:32:10 +00:00
__bobthefish_prompt_git $git_root
2016-03-30 23:13:39 +00:00
else if [ " $hg_root " ]
__bobthefish_prompt_hg $hg_root
2013-09-18 06:17:15 +00:00
else
__bobthefish_prompt_dir
end
2016-03-30 23:13:39 +00:00
2013-09-18 06:17:15 +00:00
__bobthefish_finish_segments
end