<commit_before># Support fish < 2.2
switch "$FISH_VERSION"; case 2.1.2 2.1.1 2.1.0 2.0.0
  for line in (cat (dirname (status -f))/abbreviations)
    # 1.  Strip out comments
    # 2.  Squeeze repeating spaces
    # 3.  Strip trailing whitespaces
    set line (echo "$line" | cut -d '#' -f 1 | tr -s ' ' | sed 's/[[:space:]]*$//')

    # Skip empty lines
    if not [ "$line" ]; continue; end

    # Parse lines
    set key   (echo "$line" | cut -d ' ' -f 1)
    set value (echo "$line" | cut -d ' ' -f 2-)

    alias $key $value
  end
  exit
end

# Skip if cgitc_revision is up to date
set -l current_revision (git -C (dirname (realpath (status -f))) rev-parse HEAD)
if [ "$cgitc_revision" != "$current_revision" ]
  printf 'Initializing \x1b[33mcgitc\x1b[0m ... '
  set -l cgitc_text (
    for line in (cat (dirname (realpath (status -f)))/abbreviations)
      # 1.  Strip out comments
      # 2.  Squeeze repeating spaces
      # 3.  Strip trailing whitespaces
      set line (echo "$line" | cut -d '#' -f 1 | tr -s ' ' | sed 's/[[:space:]]*$//')

      # Skip empty lines
      if not [ "$line" ]; continue; end

      # Tokenize
      set line (string split ' ' $line)

      # Wrap with calling 'abbr'
      echo "abbr --add --global -- $line[1] \"$line[2..-1]\""
    end 
  )
  echo -s \n$cgitc_text > (realpath (dirname (status -f)))/run.fish

  set -U cgitc_revision "$current_revision"
  echo 'Done'
end
source (realpath (dirname (status -f)))/run.fish<commit_msg>Usage of fish_user_abbreviations for fish < 3.0.0<commit_after># Support fish < 2.2
if printf '2.2.0\n%s' "$FISH_VERSION" | sort --check=silent --version-sort
  for line in (cat (dirname (status -f))/abbreviations)
    # 1.  Strip out comments
    # 2.  Squeeze repeating spaces
    # 3.  Strip trailing whitespaces
    set line (echo "$line" | cut -d '#' -f 1 | tr -s ' ' | sed 's/[[:space:]]*$//')

    # Skip empty lines
    if not [ "$line" ]; continue; end

    # Parse lines
    set key   (echo "$line" | cut -d ' ' -f 1)
    set value (echo "$line" | cut -d ' ' -f 2-)

    alias $key $value
  end
  exit
end

# Skip if cgitc_revision is up to date
set -l current_revision (git -C (dirname (realpath (status -f))) rev-parse HEAD)
if [ "$cgitc_revision" != "$current_revision" ]
  printf 'Initializing \x1b[33mcgitc\x1b[0m ... '

  set -l cgitc_text

  if printf '3.0.0\n%s' "$FISH_VERSION" | sort --check=silent --version-sort
    # For 2.2.0 < fish < 3.0.0 use fish_user_abbreviations env. var
    set -l cgitc_text (
      for line in (cat (dirname (realpath (status -f)))/abbreviations)
        # 1.  Strip out comments
        # 2.  Squeeze repeating spaces
        # 3.  Strip trailing whitespaces
        set line (echo "$line" | cut -d '#' -f 1 | tr -s ' ' | sed 's/[[:space:]]*$//')

        # Skip empty lines
        if not [ "$line" ]; continue; end

        # Wrap with double quote
        echo "\"$line\""
      end | tr '\n' ' '
    )
    echo "set -gx fish_user_abbreviations \$fish_user_abbreviations $cgitc_text" > (realpath (dirname (status -f)))/run.fish
  else
    # For fish > 3.0.0 use abbr command
    set cgitc_text (
      for line in (cat (dirname (realpath (status -f)))/abbreviations)
        # 1.  Strip out comments
        # 2.  Squeeze repeating spaces
        # 3.  Strip trailing whitespaces
        set line (echo "$line" | cut -d '#' -f 1 | tr -s ' ' | sed 's/[[:space:]]*$//')

        # Skip empty lines
        if not [ "$line" ]; continue; end

        # Tokenize
        set line (string split ' ' $line)

        # Wrap with calling 'abbr'
        echo "abbr --add --global -- $line[1] \"$line[2..-1]\""
      end
    )
    echo -s \n$cgitc_text > (realpath (dirname (status -f)))/run.fish
  end
  set -U cgitc_revision "$current_revision"
  echo 'Done'
end
source (realpath (dirname (status -f)))/run.fish
{'fraction_non_alphanumeric': 0.15643771219639593, 'fraction_numerical': 0.01932619482893706, 'mean_word_length': 2.307426597582038, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, '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': '697729', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1382, 'n_words': 445}