<commit_before>" MIT License. Copyright (c) 2013-2020 <NAME> et al.
" This extension is inspired by vim-anzu <https://github.com/osyo-manga/vim-anzu>.
" vim: et ts=2 sts=2 sw=2

scriptencoding utf-8

if !exists('*searchcount')
  finish
endif

function! airline#extensions#searchcount#init(ext) abort
  call a:ext.add_statusline_func('airline#extensions#searchcount#apply')
endfunction

function! airline#extensions#searchcount#apply(...) abort
  call airline#extensions#append_to_section('y',
        \ '%{v:hlsearch ? airline#extensions#searchcount#status() : ""}')
endfunction

function! airline#extensions#searchcount#status() abort
  let result = searchcount(#{recompute: 1})
  if empty(result) || result.total ==# 0
    return ''
  endif
  if result.incomplete ==# 1     " timed out
    return printf(' /%s [?/??]', @/)
  elseif result.incomplete ==# 2 " max count exceeded
    if result.total > result.maxcount &&
          \  result.current > result.maxcount
      return printf('%s[>%d/>%d]', @/,
            \		    result.current, result.total)
    elseif result.total > result.maxcount
      return printf('%s[%d/>%d]', @/,
            \		    result.current, result.total)
    endif
  endif
  return printf('%s[%d/%d]', @/,
        \		result.current, result.total)
endfunction

autocmd CursorMoved *
      \ let s:searchcount_timer = timer_start(
      \   10, function('s:update_searchcount'))

function! s:update_searchcount(timer) abort
  if a:timer ==# s:searchcount_timer
    call searchcount(#{
          \ recompute: 1, maxcount: 0, timeout: 100})
  endif
endfunction<commit_msg>[fixup] Release the search restriction and remove unnecessary functions<commit_after>" MIT License. Copyright (c) 2013-2020 <NAME> et al.
" This extension is inspired by vim-anzu <https://github.com/osyo-manga/vim-anzu>.
" vim: et ts=2 sts=2 sw=2

scriptencoding utf-8

if !exists('*searchcount')
  finish
endif

function! airline#extensions#searchcount#init(ext) abort
  call a:ext.add_statusline_func('airline#extensions#searchcount#apply')
endfunction

function! airline#extensions#searchcount#apply(...) abort
  call airline#extensions#append_to_section('y',
        \ '%{v:hlsearch ? airline#extensions#searchcount#status() : ""}')
endfunction

function! airline#extensions#searchcount#status() abort
  let result = searchcount(#{recompute: 1, maxcount: -1})
  if empty(result) || result.total ==# 0
    return ''
  endif
  if result.incomplete ==# 1     " timed out
    return printf(' /%s [?/??]', @/)
  elseif result.incomplete ==# 2 " max count exceeded
    if result.total > result.maxcount &&
          \  result.current > result.maxcount
      return printf('%s[>%d/>%d]', @/,
            \		    result.current, result.total)
    elseif result.total > result.maxcount
      return printf('%s[%d/>%d]', @/,
            \		    result.current, result.total)
    endif
  endif
  return printf('%s[%d/%d]', @/,
        \		result.current, result.total)
endfunction
{'fraction_non_alphanumeric': 0.14767363452461227, 'fraction_numerical': 0.013486176668914362, 'mean_word_length': 3.5646153846153847, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '966414', 'n_tokens_mistral': 1005, 'n_tokens_neox': 954, 'n_words': 214}