diff --git a/functions/__bobthefish_glyphs.fish b/functions/__bobthefish_glyphs.fish index 036a66c..1adb236 100644 --- a/functions/__bobthefish_glyphs.fish +++ b/functions/__bobthefish_glyphs.fish @@ -50,7 +50,7 @@ function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish' set -x git_plus_minus_glyph '±' # Fossil glyph (it reuses most of the git glyphs) - set -x fossil_glyph '🦴' + set -x fossil_glyph \U1F9B4 # Unicode bone emoji # Disable Powerline fonts (unless we're using nerd fonts instead) if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ] @@ -86,7 +86,7 @@ function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish' set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip set git_untracked_glyph \uF128 '' # nf-fa-question # set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h - set fossil_glyph '󰂹' + set fossil_glyph \UF00B9 # nf-md-bone set git_ahead_glyph \uF47B # nf-oct-chevron_up set git_behind_glyph \uF47C # nf-oct-chevron_down @@ -99,5 +99,6 @@ function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish' # Avoid ambiguous glyphs if [ "$theme_avoid_ambiguous_glyphs" = "yes" ] set git_untracked_glyph '...' + set fossil_glyph '' # blank, for lack of a good fallback end end diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 578916b..61bd974 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -73,7 +73,7 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish end function __bobthefish_fossil_branch -S -d 'Get the current fossil branch' - set -l branch (command fossil branch 2>/dev/null) + set -l branch (command fossil branch 2>/dev/null | string trim --left --chars=' *') echo "$branch_glyph $branch" end @@ -1038,7 +1038,7 @@ end # ============================== function __bobthefish_prompt_fossil -S -a fossil_root_dir -a real_pwd -d 'Display the actual fossil state' - set fossil_statuses (command fossil changes --differ 2>/dev/null | cut -d' ' -f1 | sort -u) + set -f fossil_statuses (command fossil changes --differ 2>/dev/null | cut -d' ' -f1 | sort -u) # Fossil doesn't really stage changes; untracked files are ignored, tracked files are committed by default # It also syncs by default when you commit, and monitors for conflicts (which will be reported here) @@ -1054,7 +1054,7 @@ function __bobthefish_prompt_fossil -S -a fossil_root_dir -a real_pwd -d 'Displa end end - set flags "$dirty$new$conflict" + set -f flags "$dirty$new$conflict" [ "$flags" ] and set flags " $flags" @@ -1069,7 +1069,6 @@ function __bobthefish_prompt_fossil -S -a fossil_root_dir -a real_pwd -d 'Displa __bobthefish_start_segment $flag_colors echo -ns $fossil_glyph ' ' - __bobthefish_start_segment $flag_colors echo -ns (__bobthefish_fossil_branch) $flags ' ' set_color normal @@ -1309,22 +1308,16 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' set -l hg_root_dir (__bobthefish_hg_project_dir $real_pwd) set -l fossil_root_dir (__bobthefish_fossil_project_dir $real_pwd) - if [ "$git_root_dir" -a "$hg_root_dir" ] - # only show the closest parent - switch $git_root_dir - case $hg_root_dir\* - __bobthefish_prompt_git $git_root_dir $real_pwd - case \* - __bobthefish_prompt_hg $hg_root_dir $real_pwd - end - else if [ "$git_root_dir" ] - __bobthefish_prompt_git $git_root_dir $real_pwd - else if [ "$hg_root_dir" ] - __bobthefish_prompt_hg $hg_root_dir $real_pwd - else if [ "$fossil_root_dir" ] - __bobthefish_prompt_fossil $fossil_root_dir $real_pwd - else - __bobthefish_prompt_dir $real_pwd + # only show the closest parent + switch (path sort -r "$git_root_dir" "$hg_root_dir" "$fossil_root_dir")[1] + case '' + __bobthefish_prompt_dir $real_pwd + case "$git_root_dir" + __bobthefish_prompt_git $git_root_dir $real_pwd + case "$hg_root_dir" + __bobthefish_prompt_hg $hg_root_dir $real_pwd + case "$fossil_root_dir" + __bobthefish_prompt_fossil $fossil_root_dir $real_pwd end __bobthefish_finish_segments