<commit_before>" Do smarter grep by ignoring files we probably don't want to search.
"

if exists('loaded_smartgrep_grep') || &cp || version < 700
    finish
endif
let loaded_smartgrep_grep = 1

if !exists("g:searchsavvy_smartgrep_auto_enable")
    let g:searchsavvy_smartgrep_auto_enable = 1
endif

" Pass smarter options to grep. Can't use GREP_OPTIONS (it's deprecated and
" breaks things when used globally). When "smart" behaviour is undesireable,
" you can use SmartGrepToggle to turn it back off.
if executable('grep')
    " We always want grep if possible (not findstr). Use -H so it works on a
    " single file. (Apparently some greps may not support -H. How to fix
    " that?)
    let s:standard_args = ' -nH '

    " While GREP_OPTIONS was dangerous, it could be safely used within
    " confined contexts. However, it's no longer supported:
    "   https://lists.gnu.org/archive/html/grep-commit/2014-09/msg00007.html
    " Unfortunately, the only way to pass options is directly on the
    " command-line. The quickfix window title displays the grepprg used, and
    " we use so many options it would be hard to see what you searched for.
    " Use a script to avoid the options obscuring your query in the quickfix
    " window title.
    let s:smart_grepprg = fnamemodify(expand('<sfile>'), ':p:h:h') . '/bin/smartgrep' . s:standard_args

    " Generally, we don't want to look in nonsense files. If you really want
    " these, then toggle off intelligence. Pass 1 to force smartness.
    function! SmartGrepToggle(...)
        let force_on = a:0 && a:1
        if force_on
            let &grepprg = s:smart_grepprg
            return 'grep: smart'
        else
            let &grepprg = 'grep'. s:standard_args
            return 'grep: basic'
        endif
    endfunction

    if g:searchsavvy_smartgrep_auto_enable
        call SmartGrepToggle(1)
    endif
    command! SmartGrepToggle echo SmartGrepToggle()
else
    " If grep isn't installed, then use vimgrep instead of falling back on 
    " findstr or other nonsense!
    set grepprg=internal
endif
<commit_msg>Always invoke SmartGrepToggle so we set grepprg<commit_after>" Do smarter grep by ignoring files we probably don't want to search.
"

if exists('loaded_smartgrep_grep') || &cp || version < 700
    finish
endif
let loaded_smartgrep_grep = 1

if !exists("g:searchsavvy_smartgrep_auto_enable")
    let g:searchsavvy_smartgrep_auto_enable = 1
endif

" Pass smarter options to grep. Can't use GREP_OPTIONS (it's deprecated and
" breaks things when used globally). When "smart" behaviour is undesireable,
" you can use SmartGrepToggle to turn it back off.
if executable('grep')
    " We always want grep if possible (not findstr). Use -H so it works on a
    " single file. (Apparently some greps may not support -H. How to fix
    " that?)
    let s:standard_args = ' -nH '

    " While GREP_OPTIONS was dangerous, it could be safely used within
    " confined contexts. However, it's no longer supported:
    "   https://lists.gnu.org/archive/html/grep-commit/2014-09/msg00007.html
    " Unfortunately, the only way to pass options is directly on the
    " command-line. The quickfix window title displays the grepprg used, and
    " we use so many options it would be hard to see what you searched for.
    " Use a script to avoid the options obscuring your query in the quickfix
    " window title.
    let s:smart_grepprg = fnamemodify(expand('<sfile>'), ':p:h:h') . '/bin/smartgrep' . s:standard_args

    " Generally, we don't want to look in nonsense files. If you really want
    " these, then toggle off intelligence. Pass 1 to force smartness.
    function! SmartGrepToggle(...)
        let force_on = a:0 && a:1
        if force_on
            let &grepprg = s:smart_grepprg
            return 'grep: smart'
        else
            let &grepprg = 'grep'. s:standard_args
            return 'grep: basic'
        endif
    endfunction

    call SmartGrepToggle(g:searchsavvy_smartgrep_auto_enable)
    command! SmartGrepToggle echo SmartGrepToggle()
else
    " If grep isn't installed, then use vimgrep instead of falling back on 
    " findstr or other nonsense!
    set grepprg=internal
endif

{'fraction_non_alphanumeric': 0.07730851825340014, 'fraction_numerical': 0.009305654974946313, 'mean_word_length': 3.125984251968504, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4852221', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1242, 'n_words': 489}