<commit_before># Toggle wait
# Given no arguments, switches the state of the editor ($VISUAL) wait flag.
# Otherwise sets it to the given state (on / off)
function toggle_wait --argument-names state
    # Empty toggles the current state.
    if test -z $state
        if test -z $VISUAL
            and string match --ignore-case '*'$WAIT_FLAG $EDITOR >/dev/null
            or string match --ignore-case '*'$WAIT_FLAG $VISUAL >/dev/null
            echo "Wait mode enabled, disabling"
            set state off
        else
            echo "Wait mode disabled, enabling"
            set state on
        end
    end

    switch $state
        case on ON On
            if test -z $VISUAL
                set --global --export EDITOR "$EDITOR_CLI $CLI_WAIT_FLAG"
            else
                set --global --export VISUAL "$EDITOR_GUI $GUI_WAIT_FLAG"
            end
        case off OFF Off
            if test -z $VISUAL
                set --global --export EDITOR $EDITOR_CLI
            else
                set --global --export VISUAL $EDITOR_GUI
            end
        case '*'
            echo "Usage: toggle_wait [on|off]"
            return 1
    end

    # echo EDITOR: $EDITOR
    # echo VISUAL: $VISUAL
end<commit_msg>[toggle_wait] Fix non-zero status, add confirmation of change<commit_after># Toggle wait
# Given no arguments, switches the state of the editor ($VISUAL) wait flag.
# Otherwise sets it to the given state (on / off)
function toggle_wait --argument-names state
    # Empty toggles the current state.
    if test -z $state
        if test -z $VISUAL
            and string match --ignore-case '*'$WAIT_FLAG $EDITOR >/dev/null
            or string match --ignore-case '*'$WAIT_FLAG $VISUAL >/dev/null
            echo -n "Wait mode enabled, disabling"
            set state off
        else
            echo -n "Wait mode disabled, enabling"
            set state on
        end
    end

    switch $state
        case on ON On
            if test -z $VISUAL
                set --global --export EDITOR "$EDITOR_CLI $CLI_WAIT_FLAG"
                or true # FIXME: set command returns non-zero even when sucessful
                echo " (EDITOR: $EDITOR)"
            else
                set --global --export VISUAL "$EDITOR_GUI $GUI_WAIT_FLAG"
                or true
                echo " (VISUAL: $VISUAL)"
            end
        case off OFF Off
            if test -z $VISUAL
                set --global --export EDITOR $EDITOR_CLI
                or true
                echo " (EDITOR: $EDITOR)"
            else
                set --global --export VISUAL $EDITOR_GUI
                or true
                echo " (VISUAL: $VISUAL)"
            end
        case '*'
            echo "Usage: toggle_wait [on|off]"
            return 1
    end
end
{'fraction_non_alphanumeric': 0.07906976744186046, 'fraction_numerical': 0.0007155635062611807, 'mean_word_length': 1.4787234042553192, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3615690', 'n_tokens_mistral': 783, 'n_tokens_neox': 749, 'n_words': 296}