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
|
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
|
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
|
2015-11-22 15:48:49 +00:00
|
|
|
# set -g theme_display_vi yes
|
2015-11-20 14:54:31 +00:00
|
|
|
# set -g theme_display_vi_hide_mode default
|
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
|
|
|
|
|
|
|
|
# ===========================
|
|
|
|
# Helper methods
|
|
|
|
# ===========================
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
# function __bobthefish_in_git -S -d 'Check whether pwd is inside a git repo'
|
2016-03-30 06:28:25 +00:00
|
|
|
# command which git > /dev/null ^&1
|
|
|
|
# and command git rev-parse --is-inside-work-tree >/dev/null ^&1
|
2014-11-22 17:32:10 +00:00
|
|
|
# end
|
2013-09-18 06:17:15 +00:00
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
# function __bobthefish_in_hg -S -d 'Check whether pwd is inside a hg repo'
|
2016-03-30 06:28:25 +00:00
|
|
|
# command which hg > /dev/null ^&1
|
|
|
|
# and command hg stat > /dev/null ^&1
|
2014-11-22 17:32:10 +00:00
|
|
|
# end
|
2014-11-16 10:47:15 +00:00
|
|
|
|
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)
|
2013-09-18 06:17:15 +00:00
|
|
|
if [ $status -gt 0 ]
|
2014-11-23 18:27:18 +00:00
|
|
|
set -l branch (command git show-ref --head -s --abbrev | head -n1 ^/dev/null)
|
2014-05-14 19:37:52 +00:00
|
|
|
set ref "$__bobthefish_detached_glyph $branch"
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
2016-03-30 06:28:25 +00:00
|
|
|
echo $ref | sed "s#refs/heads/#$__bobthefish_branch_glyph #"
|
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'
|
2015-10-14 03:40:44 +00:00
|
|
|
echo -n (dirname $current_dir) | sed -e 's#/private##' -e "s#^$HOME#~#" -e 's#/\(\.\{0,1\}[^/]\)\([^/]*\)#/\1#g' -e 's#/$##'
|
2013-09-18 06:17:15 +00:00
|
|
|
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
|
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
|
|
|
|
|
|
|
|
set -l project_dir (dirname $git_dir)
|
|
|
|
|
|
|
|
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
|
2016-03-30 06:28:25 +00:00
|
|
|
set -l d $PWD
|
2014-11-23 19:36:12 +00:00
|
|
|
while not [ $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
|
|
|
|
set d (dirname $d)
|
|
|
|
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'
|
2015-10-14 03:40:44 +00:00
|
|
|
echo "$PWD" | sed -e "s#$current_dir##g" -e 's#^/##'
|
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
|
|
|
|
|
2015-06-26 15:01:02 +00:00
|
|
|
command git rev-list --left-right '@{upstream}...HEAD' ^/dev/null | awk '/>/ {a += 1} /</ {b += 1} {if (a > 0 && b > 0) nextfile} END {if (a > 0 && b > 0) print "±"; else if (a > 0) print "+"; else if (b > 0) print "-"}'
|
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
|
|
|
|
echo "↑$ahead"
|
|
|
|
case '0 *' # behind upstream
|
|
|
|
echo "↓$behind"
|
|
|
|
case '*' # diverged from upstream
|
|
|
|
echo "↑$ahead↓$behind"
|
|
|
|
end
|
|
|
|
end
|
2013-09-18 06:17:15 +00:00
|
|
|
|
|
|
|
# ===========================
|
|
|
|
# Segment functions
|
|
|
|
# ===========================
|
|
|
|
|
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...
|
|
|
|
set_color -b $bg
|
|
|
|
set_color $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-03-30 20:24:51 +00:00
|
|
|
set -l bg_color $__bobthefish_dk_grey
|
|
|
|
set -l fg_color $__bobthefish_med_grey
|
|
|
|
|
|
|
|
if not [ -w "$current_dir" ]
|
|
|
|
set bg_color $__bobthefish_dk_red
|
|
|
|
set fg_color $__bobthefish_lt_red
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
|
|
|
|
2016-03-30 20:24:51 +00:00
|
|
|
__bobthefish_start_segment $bg_color $fg_color
|
|
|
|
|
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")
|
2013-09-18 06:17:15 +00:00
|
|
|
set parent "$parent/"
|
2015-10-14 03:40:44 +00:00
|
|
|
set directory (basename "$current_dir")
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
|
|
|
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -n $parent
|
2013-09-18 06:17:15 +00:00
|
|
|
set_color fff --bold
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns $directory ' '
|
2013-09-18 06:17:15 +00:00
|
|
|
set_color normal
|
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_finish_segments -S -d 'Close open prompt segments'
|
2016-02-04 07:10:57 +00:00
|
|
|
if [ "$__bobthefish_current_bg" != '' ]
|
2013-09-18 06:17:15 +00:00
|
|
|
set_color -b normal
|
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 ' '
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
2016-02-04 07:10:57 +00:00
|
|
|
|
|
|
|
set __bobthefish_current_bg
|
2016-04-04 15:36:11 +00:00
|
|
|
set_color normal
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# ===========================
|
|
|
|
# Theme components
|
|
|
|
# ===========================
|
|
|
|
|
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
|
|
|
|
if type -q VBoxManage
|
|
|
|
__bobthefish_prompt_vagrant_vbox
|
|
|
|
else if grep vmware_fusion Vagrantfile >/dev/null ^&1
|
|
|
|
__bobthefish_prompt_vagrant_vmware
|
2016-02-19 07:14:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-19 18:06:52 +00:00
|
|
|
function __bobthefish_vagrant_ids -S -d 'List Vagrant machine ids'
|
2016-03-11 21:28:47 +00:00
|
|
|
for file in .vagrant/machines/**/id
|
|
|
|
read id <$file
|
|
|
|
echo $id
|
2016-03-10 00:54:32 +00:00
|
|
|
end
|
2016-02-19 07:14:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function __bobthefish_prompt_vagrant_vbox -S -d 'Display VirtualBox Vagrant status'
|
|
|
|
set -l vagrant_status
|
2016-02-19 18:06:52 +00:00
|
|
|
for id in (__bobthefish_vagrant_ids)
|
2016-03-30 20:24:51 +00:00
|
|
|
set -l vm_status (VBoxManage showvminfo --machinereadable $id ^/dev/null | command grep 'VMState=' | tr -d '"' | cut -d '=' -f 2)
|
2016-02-19 07:14:13 +00:00
|
|
|
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"
|
2015-12-16 18:12:21 +00:00
|
|
|
end
|
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
|
|
|
|
|
|
|
__bobthefish_start_segment $__bobthefish_vagrant fff --bold
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns $vagrant_status ' '
|
2016-02-19 07:14:13 +00:00
|
|
|
set_color normal
|
|
|
|
end
|
|
|
|
|
|
|
|
function __bobthefish_prompt_vagrant_vmware -S -d 'Display VMWare Vagrant status'
|
|
|
|
set -l vagrant_status
|
|
|
|
for id in (__bobthefish_vagrant_ids)
|
|
|
|
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
|
|
|
|
end
|
2016-02-19 07:14:13 +00:00
|
|
|
[ -z "$vagrant_status" ]; and return
|
|
|
|
|
|
|
|
__bobthefish_start_segment $__bobthefish_vagrant fff --bold
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns $vagrant_status ' '
|
2016-02-19 07:14:13 +00:00
|
|
|
set_color normal
|
2015-12-16 18:12:21 +00:00
|
|
|
end
|
|
|
|
|
2016-02-04 07:06:15 +00:00
|
|
|
function __bobthefish_prompt_status -S -a last_status -d 'Display symbols for a non zero exit status, root and background jobs'
|
2013-09-18 06:17:15 +00:00
|
|
|
set -l nonzero
|
|
|
|
set -l superuser
|
|
|
|
set -l bg_jobs
|
|
|
|
|
|
|
|
# Last exit was nonzero
|
2016-03-30 06:28:25 +00:00
|
|
|
[ $last_status -ne 0 ]
|
|
|
|
and set nonzero $__bobthefish_nonzero_exit_glyph
|
2013-09-18 06:17:15 +00:00
|
|
|
|
|
|
|
# if superuser (uid == 0)
|
2016-03-30 06:28:25 +00:00
|
|
|
[ (id -u $USER) -eq 0 ]
|
|
|
|
and set superuser $__bobthefish_superuser_glyph
|
2013-09-18 06:17:15 +00:00
|
|
|
|
|
|
|
# Jobs display
|
2016-03-30 06:28:25 +00:00
|
|
|
[ (jobs -l | wc -l) -gt 0 ]
|
|
|
|
and set bg_jobs $__bobthefish_bg_job_glyph
|
2013-09-18 06:17:15 +00:00
|
|
|
|
2014-11-23 18:36:58 +00:00
|
|
|
if [ "$nonzero" -o "$superuser" -o "$bg_jobs" ]
|
2013-09-18 06:17:15 +00:00
|
|
|
__bobthefish_start_segment fff 000
|
|
|
|
if [ "$nonzero" ]
|
2014-05-14 19:37:52 +00:00
|
|
|
set_color $__bobthefish_med_red --bold
|
2016-03-03 11:12:09 +00:00
|
|
|
if [ "$theme_show_exit_status" = 'yes' ]
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns $last_status ' '
|
2016-03-03 02:40:04 +00:00
|
|
|
else
|
|
|
|
echo -n $__bobthefish_nonzero_exit_glyph
|
|
|
|
end
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if [ "$superuser" ]
|
2014-05-14 19:37:52 +00:00
|
|
|
set_color $__bobthefish_med_green --bold
|
|
|
|
echo -n $__bobthefish_superuser_glyph
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if [ "$bg_jobs" ]
|
2014-05-14 19:37:52 +00:00
|
|
|
set_color $__bobthefish_slate_blue --bold
|
|
|
|
echo -n $__bobthefish_bg_job_glyph
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
2014-05-14 20:05:25 +00:00
|
|
|
|
|
|
|
set_color normal
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_prompt_user -S -d 'Display actual user if different from $default_user'
|
2013-09-18 06:17:15 +00:00
|
|
|
if [ "$theme_display_user" = 'yes' ]
|
|
|
|
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
|
2014-05-14 19:37:52 +00:00
|
|
|
__bobthefish_start_segment $__bobthefish_lt_grey $__bobthefish_slate_blue
|
2016-03-11 21:28:47 +00:00
|
|
|
set -l IFS .
|
|
|
|
hostname | read -l hostname __
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns (whoami) '@' $hostname ' '
|
2013-09-18 06:17:15 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
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
|
|
|
|
|
|
|
set -l flag_bg $__bobthefish_lt_green
|
|
|
|
set -l flag_fg $__bobthefish_dk_green
|
2014-11-23 18:36:58 +00:00
|
|
|
if [ "$dirty" ]
|
2014-11-16 10:47:15 +00:00
|
|
|
set flag_bg $__bobthefish_med_red
|
|
|
|
set flag_fg fff
|
|
|
|
end
|
|
|
|
|
2015-10-14 03:40:44 +00:00
|
|
|
__bobthefish_path_segment $current_dir
|
2014-11-16 10:47:15 +00:00
|
|
|
|
2014-11-18 02:40:30 +00:00
|
|
|
__bobthefish_start_segment $flag_bg $flag_fg
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns $__bobthefish_hg_glyph ' '
|
2014-11-18 02:40:30 +00:00
|
|
|
|
2014-11-23 17:34:30 +00:00
|
|
|
__bobthefish_start_segment $flag_bg $flag_fg --bold
|
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-03-02 05:23:45 +00:00
|
|
|
__bobthefish_start_segment $__bobthefish_dk_grey $__bobthefish_med_grey
|
2014-11-16 10:47:15 +00:00
|
|
|
else
|
|
|
|
__bobthefish_start_segment $__bobthefish_med_red $__bobthefish_lt_red
|
|
|
|
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'
|
2013-09-18 06:17:15 +00:00
|
|
|
set -l dirty (command git diff --no-ext-diff --quiet --exit-code; or echo -n '*')
|
|
|
|
set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code; or echo -n '~')
|
2014-11-23 18:27:18 +00:00
|
|
|
set -l stashed (command git rev-parse --verify --quiet refs/stash >/dev/null; and echo -n '$')
|
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 ''
|
2016-03-30 20:24:51 +00:00
|
|
|
set -l show_untracked (command git config --bool bash.showUntrackedFiles)
|
2015-04-24 17:59:50 +00:00
|
|
|
if [ "$theme_display_git_untracked" != 'no' -a "$show_untracked" != 'false' ]
|
2015-10-26 14:16:21 +00:00
|
|
|
set new (command git ls-files --other --exclude-standard --directory --no-empty-directory)
|
2015-10-14 15:23:34 +00:00
|
|
|
if [ "$new" ]
|
2015-10-14 03:34:35 +00:00
|
|
|
if [ "$theme_avoid_ambiguous_glyphs" = 'yes' ]
|
|
|
|
set new '...'
|
|
|
|
else
|
|
|
|
set new '…'
|
|
|
|
end
|
|
|
|
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
|
|
|
|
2014-05-14 19:37:52 +00:00
|
|
|
set -l flag_bg $__bobthefish_lt_green
|
|
|
|
set -l flag_fg $__bobthefish_dk_green
|
2016-05-17 20:38:01 +00:00
|
|
|
if [ "$dirty" ]
|
2014-05-14 19:37:52 +00:00
|
|
|
set flag_bg $__bobthefish_med_red
|
2013-09-18 06:17:15 +00:00
|
|
|
set flag_fg fff
|
2016-05-17 20:38:01 +00:00
|
|
|
else if [ "$staged" ]
|
2014-11-23 18:36:58 +00:00
|
|
|
set flag_bg $__bobthefish_lt_orange
|
|
|
|
set flag_fg $__bobthefish_dk_orange
|
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
|
|
|
|
2015-06-24 21:50:28 +00:00
|
|
|
__bobthefish_start_segment $flag_bg $flag_fg --bold
|
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" ]
|
|
|
|
__bobthefish_start_segment $__bobthefish_dk_grey $__bobthefish_med_grey
|
|
|
|
else
|
|
|
|
__bobthefish_start_segment $__bobthefish_med_red $__bobthefish_lt_red
|
|
|
|
end
|
|
|
|
|
|
|
|
echo -ns $project_pwd ' '
|
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
set -l project_pwd (command git rev-parse --show-prefix ^/dev/null | sed -e 's#/$##')
|
|
|
|
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/\*
|
|
|
|
set work_dir (echo $work_dir | sed -e "s#^$current_dir##")
|
|
|
|
case \*
|
|
|
|
set -e work_dir
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if [ "$project_pwd" -o "$work_dir" ]
|
|
|
|
set -l bg_color $__bobthefish_dk_grey
|
|
|
|
set -l fg_color $__bobthefish_med_grey
|
|
|
|
if not [ -w "$PWD" ]
|
|
|
|
set bg_color $__bobthefish_med_red
|
|
|
|
set fg_color $__bobthefish_lt_red
|
|
|
|
end
|
|
|
|
|
|
|
|
__bobthefish_start_segment $bg_color $fg_color
|
|
|
|
|
|
|
|
# handle work_dir != project dir
|
|
|
|
if [ "$work_dir" ]
|
|
|
|
set -l work_parent (dirname $work_dir | sed -e 's#^/##')
|
|
|
|
if [ "$work_parent" ]
|
|
|
|
set_color --background $bg_color $fg_color
|
|
|
|
echo -n "$work_parent/"
|
|
|
|
end
|
|
|
|
set_color fff --bold
|
|
|
|
echo -n (basename $work_dir)
|
|
|
|
set_color --background $bg_color $fg_color
|
|
|
|
[ "$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
|
|
|
|
set project_pwd (echo $PWD | sed -e "s#^$current_dir##" -e 's#^/##')
|
|
|
|
if [ "$project_pwd" ]
|
|
|
|
set -l bg_color $__bobthefish_dk_grey
|
|
|
|
set -l fg_color $__bobthefish_med_grey
|
|
|
|
if not [ -w "$PWD" ]
|
|
|
|
set bg_color $__bobthefish_med_red
|
|
|
|
set fg_color $__bobthefish_lt_red
|
|
|
|
end
|
|
|
|
|
|
|
|
__bobthefish_start_segment $bg_color $fg_color
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_prompt_vi -S -d 'Display vi mode'
|
2015-11-22 11:53:49 +00:00
|
|
|
[ "$theme_display_vi" = 'yes' -a "$fish_bind_mode" != "$theme_display_vi_hide_mode" ]; or return
|
|
|
|
switch $fish_bind_mode
|
|
|
|
case default
|
|
|
|
__bobthefish_start_segment $__bobthefish_med_grey $__bobthefish_dk_grey --bold
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -n 'N '
|
2015-11-22 11:53:49 +00:00
|
|
|
case insert
|
|
|
|
__bobthefish_start_segment $__bobthefish_lt_green $__bobthefish_dk_grey --bold
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -n 'I '
|
2015-11-22 11:53:49 +00:00
|
|
|
case visual
|
|
|
|
__bobthefish_start_segment $__bobthefish_lt_orange $__bobthefish_dk_grey --bold
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -n 'V '
|
2015-10-29 14:25:04 +00:00
|
|
|
end
|
2015-11-22 11:53:49 +00:00
|
|
|
set_color normal
|
2015-10-29 14:25:04 +00:00
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_virtualenv_python_version -S -d 'Get current python version'
|
2014-11-22 09:47:04 +00:00
|
|
|
set -l python_version (readlink (which python))
|
2016-03-30 06:28:25 +00:00
|
|
|
[ -z "$python_version" ]
|
|
|
|
and set python_version (which python)
|
2016-01-25 16:00:29 +00:00
|
|
|
switch (basename "$python_version")
|
|
|
|
case 'python' 'python2*'
|
2014-11-20 21:24:29 +00:00
|
|
|
echo $__bobthefish_superscript_glyph[2]
|
2015-02-22 10:17:19 +00:00
|
|
|
case 'python3*'
|
2014-11-20 21:24:29 +00:00
|
|
|
echo $__bobthefish_superscript_glyph[3]
|
2015-02-22 10:17:19 +00:00
|
|
|
case 'pypy*'
|
2014-11-20 21:24:29 +00:00
|
|
|
echo $__bobthefish_pypy_glyph
|
2014-11-22 09:47:04 +00:00
|
|
|
end
|
2014-11-20 20:58:23 +00:00
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_prompt_virtualfish -S -d "Display activated virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself)"
|
2014-11-23 20:27:57 +00:00
|
|
|
[ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ]; and return
|
2014-11-22 09:47:04 +00:00
|
|
|
set -l version_glyph (__bobthefish_virtualenv_python_version)
|
2014-11-23 18:36:58 +00:00
|
|
|
if [ "$version_glyph" ]
|
2014-11-22 09:47:04 +00:00
|
|
|
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns $__bobthefish_virtualenv_glyph $version_glyph ' '
|
2014-11-22 09:47:04 +00:00
|
|
|
end
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns (basename "$VIRTUAL_ENV") ' '
|
2014-11-20 20:58:23 +00:00
|
|
|
set_color normal
|
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_rvm_parse_ruby -S -a ruby_string scope -d 'Parse RVM Ruby string'
|
2015-10-27 18:05:01 +00:00
|
|
|
# Function arguments:
|
|
|
|
# - 'ruby-2.2.3@rails', 'jruby-1.7.19'...
|
|
|
|
# - 'default' or 'current'
|
2016-03-11 21:28:47 +00:00
|
|
|
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 __
|
2015-10-27 18:05:01 +00:00
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM'
|
2015-10-27 18:05:01 +00:00
|
|
|
# More `sed`/`grep`/`cut` magic...
|
2016-03-11 21:28:47 +00:00
|
|
|
set -l __rvm_default_ruby (grep GEM_HOME ~/.rvm/environments/default | sed -e"s/'//g" | sed -e's/.*\///')
|
2015-10-27 18:05:01 +00:00
|
|
|
set -l __rvm_current_ruby (rvm-prompt i v g)
|
2016-03-11 21:28:47 +00:00
|
|
|
[ "$__rvm_default_ruby" = "$__rvm_current_ruby" ]; and return
|
2016-03-11 19:23:47 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2015-10-27 18:05:01 +00:00
|
|
|
# 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
|
2016-03-11 21:28:47 +00:00
|
|
|
|
2015-10-27 18:05:01 +00:00
|
|
|
# If interpreter differs form default interpreter, show everything:
|
2016-03-11 21:28:47 +00:00
|
|
|
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
|
2015-10-27 18:05:01 +00:00
|
|
|
# If version differs form default version
|
|
|
|
else if [ "$__rvm_default_ruby_version" != "$__rvm_current_ruby_version" ]
|
2016-03-11 21:28:47 +00:00
|
|
|
if [ "$__rvm_current_ruby_gemset" = 'global' ]
|
|
|
|
rvm-prompt v
|
|
|
|
else
|
|
|
|
rvm-prompt v g
|
|
|
|
end
|
2015-10-27 18:05:01 +00:00
|
|
|
# If gemset differs form default or 'global' gemset, just show it
|
|
|
|
else if [ "$__rvm_default_ruby_gemset" != "$__rvm_current_ruby_gemset" ]
|
2016-03-11 21:28:47 +00:00
|
|
|
rvm-prompt g
|
2015-10-27 18:05:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_show_ruby -S -d 'Current Ruby (rvm/rbenv)'
|
2015-10-27 18:05:01 +00:00
|
|
|
set -l ruby_version
|
2016-02-19 07:14:28 +00:00
|
|
|
if type -q rvm-prompt
|
2015-10-27 18:05:01 +00:00
|
|
|
set ruby_version (__bobthefish_rvm_info)
|
2016-02-19 07:14:28 +00:00
|
|
|
else if type -q rbenv
|
2014-11-23 17:34:59 +00:00
|
|
|
set ruby_version (rbenv version-name)
|
|
|
|
# Don't show global ruby version...
|
2016-03-30 06:28:25 +00:00
|
|
|
set -q RBENV_ROOT
|
|
|
|
or set -l RBENV_ROOT $HOME/.rbenv
|
|
|
|
|
2016-03-11 21:28:47 +00:00
|
|
|
read -l global_ruby_version <$RBENV_ROOT/version
|
2016-03-30 06:28:25 +00:00
|
|
|
|
|
|
|
[ "$global_ruby_version" ]
|
|
|
|
or set global_ruby_version system
|
|
|
|
|
2016-03-11 21:28:47 +00:00
|
|
|
[ "$ruby_version" = "$global_ruby_version" ]; and return
|
2016-05-23 12:48:09 +00:00
|
|
|
else if type -q chruby
|
|
|
|
set ruby_version $RUBY_VERSION
|
2014-11-23 17:34:59 +00:00
|
|
|
end
|
2015-02-10 22:02:06 +00:00
|
|
|
[ -z "$ruby_version" ]; and return
|
2014-11-23 17:34:59 +00:00
|
|
|
__bobthefish_start_segment $__bobthefish_ruby_red $__bobthefish_lt_grey --bold
|
2016-03-30 06:28:25 +00:00
|
|
|
echo -ns $__bobthefish_ruby_glyph $ruby_version ' '
|
2014-11-23 17:34:59 +00:00
|
|
|
set_color normal
|
|
|
|
end
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
|
2015-10-27 18:05:01 +00:00
|
|
|
[ "$theme_display_ruby" = 'no' ]; and return
|
|
|
|
__bobthefish_show_ruby
|
|
|
|
end
|
2013-09-18 06:17:15 +00:00
|
|
|
|
|
|
|
# ===========================
|
|
|
|
# Apply theme
|
|
|
|
# ===========================
|
|
|
|
|
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 \uE0A0
|
|
|
|
set -l __bobthefish_ln_glyph \uE0A1
|
|
|
|
set -l __bobthefish_padlock_glyph \uE0A2
|
|
|
|
set -l __bobthefish_right_black_arrow_glyph \uE0B0
|
|
|
|
set -l __bobthefish_right_arrow_glyph \uE0B1
|
|
|
|
set -l __bobthefish_left_black_arrow_glyph \uE0B2
|
|
|
|
set -l __bobthefish_left_arrow_glyph \uE0B3
|
|
|
|
|
|
|
|
if [ "$theme_powerline_fonts" = "no" ]
|
2016-05-17 21:33:31 +00:00
|
|
|
set __bobthefish_branch_glyph \u2387
|
2016-05-16 01:18:28 +00:00
|
|
|
set __bobthefish_ln_glyph ''
|
|
|
|
set __bobthefish_padlock_glyph ''
|
|
|
|
set __bobthefish_right_black_arrow_glyph ''
|
|
|
|
set __bobthefish_right_arrow_glyph ''
|
|
|
|
set __bobthefish_left_black_arrow_glyph ''
|
|
|
|
set __bobthefish_left_arrow_glyph ''
|
2016-05-15 23:43:01 +00:00
|
|
|
end
|
2016-01-25 15:06:48 +00:00
|
|
|
|
|
|
|
# Additional glyphs
|
|
|
|
set -l __bobthefish_detached_glyph \u27A6
|
|
|
|
set -l __bobthefish_nonzero_exit_glyph '! '
|
|
|
|
set -l __bobthefish_superuser_glyph '$ '
|
|
|
|
set -l __bobthefish_bg_job_glyph '% '
|
|
|
|
set -l __bobthefish_hg_glyph \u263F
|
|
|
|
|
|
|
|
# Python glyphs
|
|
|
|
set -l __bobthefish_superscript_glyph \u00B9 \u00B2 \u00B3
|
|
|
|
set -l __bobthefish_virtualenv_glyph \u25F0
|
|
|
|
set -l __bobthefish_pypy_glyph \u1D56
|
|
|
|
|
2016-02-19 06:00:31 +00:00
|
|
|
set -l __bobthefish_ruby_glyph ''
|
|
|
|
|
2016-01-25 15:06:48 +00:00
|
|
|
# Vagrant glyphs
|
|
|
|
set -l __bobthefish_vagrant_running_glyph \u2191 # ↑ 'running'
|
|
|
|
set -l __bobthefish_vagrant_poweroff_glyph \u2193 # ↓ 'poweroff'
|
|
|
|
set -l __bobthefish_vagrant_aborted_glyph \u2715 # ✕ 'aborted'
|
|
|
|
set -l __bobthefish_vagrant_saved_glyph \u21E1 # ⇡ 'saved'
|
2016-02-01 20:24:49 +00:00
|
|
|
set -l __bobthefish_vagrant_stopping_glyph \u21E3 # ⇣ 'stopping'
|
2016-01-25 15:06:48 +00:00
|
|
|
set -l __bobthefish_vagrant_unknown_glyph '!' # strange cases
|
|
|
|
|
|
|
|
# Colors
|
|
|
|
set -l __bobthefish_lt_green addc10
|
|
|
|
set -l __bobthefish_med_green 189303
|
|
|
|
set -l __bobthefish_dk_green 0c4801
|
|
|
|
|
|
|
|
set -l __bobthefish_lt_red C99
|
|
|
|
set -l __bobthefish_med_red ce000f
|
|
|
|
set -l __bobthefish_dk_red 600
|
|
|
|
set -l __bobthefish_ruby_red af0000
|
|
|
|
|
|
|
|
set -l __bobthefish_slate_blue 255e87
|
|
|
|
set -l __bobthefish_med_blue 005faf
|
|
|
|
|
|
|
|
set -l __bobthefish_lt_orange f6b117
|
|
|
|
set -l __bobthefish_dk_orange 3a2a03
|
|
|
|
|
|
|
|
set -l __bobthefish_dk_grey 333
|
|
|
|
set -l __bobthefish_med_grey 999
|
|
|
|
set -l __bobthefish_lt_grey ccc
|
|
|
|
|
|
|
|
set -l __bobthefish_dk_brown 4d2600
|
|
|
|
set -l __bobthefish_med_brown 803F00
|
|
|
|
set -l __bobthefish_lt_brown BF5E00
|
|
|
|
|
|
|
|
set -l __bobthefish_vagrant 48B4FB
|
|
|
|
|
2016-02-19 06:00:31 +00:00
|
|
|
if [ "$theme_nerd_fonts" = "yes" ]
|
|
|
|
set __bobthefish_virtualenv_glyph \uE73C ' '
|
|
|
|
set __bobthefish_ruby_glyph \uE791 ' '
|
|
|
|
end
|
|
|
|
|
2016-02-04 07:10:57 +00:00
|
|
|
# Start each line with a blank slate
|
|
|
|
set -l __bobthefish_current_bg
|
|
|
|
|
2016-02-04 07:06:15 +00:00
|
|
|
__bobthefish_prompt_status $last_status
|
2015-11-20 14:54:11 +00:00
|
|
|
__bobthefish_prompt_vi
|
2015-12-16 18:12:21 +00:00
|
|
|
__bobthefish_prompt_vagrant
|
2013-09-18 06:17:15 +00:00
|
|
|
__bobthefish_prompt_user
|
2014-11-23 17:34:59 +00:00
|
|
|
__bobthefish_prompt_rubies
|
2014-11-22 08:10:45 +00:00
|
|
|
__bobthefish_prompt_virtualfish
|
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
|