<commit_before>###############################################################################
#
# prompt theme name: budspencer
# 
# description: a sophisticated airline/powerline theme
#
# author: <NAME>
#
###############################################################################

###############################################################################
# Color definitions
###############################################################################
set -g budspencer_colors 000000 083743 445659 fdf6e3 b58900 cb4b16 dc121f af005f 6c71c4 268bd2 2aa198 859900

###############################################################################
# Utils
###############################################################################

set -g __budspencer_display_rprompt 1

function __budspencer_git_branch_name -d "Return the current branch name"
  set -l branch (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
  if test (count $branch) -eq 0
    set -l position (git describe --contains --all HEAD ^/dev/null)
      if test (count $position) -eq 0
        set -l commit (git rev-parse HEAD ^/dev/null | sed -r 's|(^.{7}).*|\1|')
        echo -n (set_color -b $budspencer_colors[11])""(set_color $budspencer_colors[1])" ➦ "$commit" "(set_color $budspencer_colors[11])
      else
        echo -n (set_color -b $budspencer_colors[9])""(set_color $budspencer_colors[1])"  "$position" "(set_color $budspencer_colors[9])
      end
  else
    echo -n (set_color -b $budspencer_colors[3])""(set_color $budspencer_colors[1])"  "$branch" "(set_color $budspencer_colors[3])
  end
end

function fish_vi_prompt_cm --description "Displays the current mode"
  switch $fish_bind_mode
    case default
      set_color -b $budspencer_colors[10] $budspencer_colors[1]
      echo -en "\033]12;#$budspencer_colors[10]\007"
      echo -n " NORMAL "
      set_color -b $budspencer_colors[1] $budspencer_colors[10]
    case insert
      set_color -b $budspencer_colors[5] $budspencer_colors[1]
      echo -en "\033]12;#$budspencer_colors[5]\007"
      echo -n " INSERT "
      set_color -b $budspencer_colors[1] $budspencer_colors[5]
    case visual
      set_color -b $budspencer_colors[8] $budspencer_colors[1]
      echo -en "\033]12;#$budspencer_colors[8]\007"
      echo -n " VISUAL "
      set_color -b $budspencer_colors[1] $budspencer_colors[8]
  end
end<commit_msg>don't change cursor color if terminal doesn't support it<commit_after>###############################################################################
#
# prompt theme name: budspencer
#
# description: a sophisticated airline/powerline theme
#
# author: <NAME>
#
###############################################################################

###############################################################################
# Color definitions
###############################################################################

# define colors
set -g budspencer_colors 000000 083743 445659 fdf6e3 b58900 cb4b16 dc121f af005f 6c71c4 268bd2 2aa198 859900

# cursor colors
set -g budspencer_cursors "\033]12;#$budspencer_colors[10]\007" "\033]12;#$budspencer_colors[5]\007" "\033]12;#$budspencer_colors[8]\007"
set -l unsupported_terminals "fbterm" "st" "linux" "screen"
for term in $unsupported_terminals
  if test $term = $TERM
    set -g budspencer_cursors "" "" ""
  end
end

###############################################################################
# Utils
###############################################################################

set -g __budspencer_display_rprompt 1

function __budspencer_git_branch_name -d "Return the current branch name"
  set -l branch (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
  if test (count $branch) -eq 0
    set -l position (git describe --contains --all HEAD ^/dev/null)
      if test (count $position) -eq 0
        set -l commit (git rev-parse HEAD ^/dev/null | sed -r 's|(^.{7}).*|\1|')
        echo -n (set_color -b $budspencer_colors[11])""(set_color $budspencer_colors[1])" ➦ "$commit" "(set_color $budspencer_colors[11])
      else
        echo -n (set_color -b $budspencer_colors[9])""(set_color $budspencer_colors[1])"  "$position" "(set_color $budspencer_colors[9])
      end
  else
    echo -n (set_color -b $budspencer_colors[3])""(set_color $budspencer_colors[1])"  "$branch" "(set_color $budspencer_colors[3])
  end
end

function fish_vi_prompt_cm --description "Displays the current mode"
  switch $fish_bind_mode
    case default
      set_color -b $budspencer_colors[10] $budspencer_colors[1]
      echo -en $budspencer_cursors[1]
      echo -n " NORMAL "
      set_color -b $budspencer_colors[1] $budspencer_colors[10]
    case insert
      set_color -b $budspencer_colors[5] $budspencer_colors[1]
      echo -en $budspencer_cursors[2]
      echo -n " INSERT "
      set_color -b $budspencer_colors[1] $budspencer_colors[5]
    case visual
      set_color -b $budspencer_colors[8] $budspencer_colors[1]
      echo -en $budspencer_cursors[3]
      echo -n " VISUAL "
      set_color -b $budspencer_colors[1] $budspencer_colors[8]
  end
end
{'fraction_non_alphanumeric': 0.28929340379722057, 'fraction_numerical': 0.04364846349579174, 'mean_word_length': 4.907514450867052, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4535137', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1630, 'n_words': 391}