<commit_before>function fish_prompt
    set -g last_status $status

    printf "%s" (set_color blue)(whoami)(set_color normal)
    printf " @ "
    printf "%s " (set_color purple)(prompt_hostname)(set_color normal)
    echo (set_color blue)(prompt_pwd)(set_color normal)
    if test $last_status -ne 0
        printf "%s" (set_color $fish_color_error)
    end
    echo '$ '(set_color normal)
end

function vi_mode
    if test "$fish_key_bindings" = "fish_vi_key_bindings"
    or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
        switch $fish_bind_mode
            case default
                set_color --bold red
                echo '[N]'
            case insert
                set_color --bold green
                echo '[I]'
            case replace-one
                set_color --bold green
                echo '[R]'
            case visual
                set_color --bold magenta
                echo '[V]'
        end
        set_color normal
        echo -n ' '
    end
end

function git_status
    if not command -s git >/dev/null
        return 1
    end
    set -l branch (git rev-parse --abbrev-ref HEAD ^/dev/null)
    if test -z $branch
        return
    end

    set -l index (git status --porcelain ^/dev/null | cut -c1-2 | sort -u)
    set -l gs
    for i in $index
        if echo $i | grep -q '^[AMRCD]'
            set gs "$gs"(set_color green)
        else
            set gs "$gs"(set_color yellow)
        end

        switch $i
            case 'A '
                set gs $gs 'A'
            case 'M ' ' M'
                set gs $gs 'M'
            case 'R '
                set gs $gs 'R'
            case 'C '
                set gs $gs 'C'
            case 'D ' ' D'
                set gs $gs 'D'
            case '\?\?'
                set gs $gs (set_color blue)'?'
            case 'U*' '*U' 'DD' 'AA'
                set gs $gs (set_color red)'!'
        end
        set gs "$gs"(set_color normal)
    end
    printf "%s %s " $gs $branch
end

function last_error
    if test $last_status -ne 0
        printf "%s " (set_color $fish_color_error)$last_status(set_color normal)
    end
end

function fish_right_prompt
    last_error
    git_status
    vi_mode
end
<commit_msg>show number of files in git status prompt, fix vi prompt<commit_after>function fish_prompt
    set -g last_status $status

    printf "%s" (set_color blue)(whoami)(set_color normal)
    printf " @ "
    printf "%s " (set_color purple)(prompt_hostname)(set_color normal)
    echo (set_color blue)(prompt_pwd)(set_color normal)
    if test $last_status -ne 0
        printf "%s" (set_color $fish_color_error)
    end
    echo '$ '(set_color normal)
end

function vi_mode
    if test "$fish_key_bindings" = "fish_vi_key_bindings"
    or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
        switch $fish_bind_mode
            case default
                set_color --bold red
                echo '[N]'
            case insert
                set_color --bold green
                echo '[I]'
            case replace_one
                set_color --bold cyan
                echo '[R]'
            case visual
                set_color --bold magenta
                echo '[V]'
        end
        set_color normal
        echo -n ' '
    end
end

function git_status
    if not command -s git >/dev/null
        return 1
    end
    set -l branch (git rev-parse --abbrev-ref HEAD ^/dev/null)
    if test -z $branch
        return
    end

    set -l git_status (git status --porcelain ^/dev/null | \
                       cut -c1-2 | \
                       sort | uniq -c | sed 's/^\s*//')
    set -l gs
    for line in $git_status
        set -l count (echo $line | cut -d' ' -f1)
        set -l symbol (echo $line | cut -d' ' -f2-)

        set gs "$gs $count"
        switch $symbol
            case '\?\?'
                set gs "$gs"(set_color cyan)'?'
            case 'U*' '*U' 'DD' 'AA'
                set gs "$gs"(set_color red)'!'
            case '*'
                if echo $symbol | grep -q '^[AMRCD]'
                    set gs $gs(set_color green)
                else
                    set gs $gs(set_color yellow)
                end
                set gs "$gs"(echo $symbol | sed 's/\s*//g')
        end
        set gs "$gs"(set_color normal)
    end
    printf "%s %s " $gs $branch
end

function last_error
    if test $last_status -ne 0
        printf "%s%s%s " (set_color $fish_color_error) $last_status (set_color normal)
    end
end

function fish_right_prompt
    last_error
    git_status
    vi_mode
end

{'fraction_non_alphanumeric': 0.0995405819295559, 'fraction_numerical': 0.0026252461168234523, 'mean_word_length': 1.5038335158817087, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6192102', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1416, 'n_words': 454}