<commit_before>" MIT License. Copyright (c) 2013-2016 <NAME>.
" vim: et ts=2 sts=2 sw=2

scriptencoding utf-8

function! airline#extensions#wordcount#formatters#default#format()
  let words = string(s:wordcount())
  if empty(words)
    return
  endif
  let result = g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
  if winwidth(0) >= 80
    let separator = s:get_decimal_group()
    if words > 999 && !empty(separator)
      " Format number according to locale, e.g. German: 1.245 or English: 1,245
      let a = join(reverse(split(words, '.\zs')),'')
      let a = substitute(a, '...', '&'.separator, 'g')
      let words = join(reverse(split(a, '.\zs')),'')
    endif
    let result = printf("%s%s", words, " words"). result
  else
    let result = printf("%s%s", words, "W"). result
  endif
  return result
endfunction

function! s:wordcount()
  if exists("*wordcount")
    let l:mode = mode()
    if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
      let l:visual_words = wordcount()['visual_words']
      if l:visual_words != ''
        return l:visual_words
      else
        return 0
      endif
    else
      return wordcount()['words']
    endif
  elseif mode() =~? 's'
    return
  else
    let old_status = v:statusmsg
    let position = getpos(".")
    exe "silent normal! g\<c-g>"<commit_msg>Better reformat wordcount format in with separator<commit_after>" MIT License. Copyright (c) 2013-2016 <NAME>.
" vim: et ts=2 sts=2 sw=2

scriptencoding utf-8

function! airline#extensions#wordcount#formatters#default#format()
  let words = string(s:wordcount())
  if empty(words)
    return
  endif
  let result = g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
  if winwidth(0) >= 80
    let separator = s:get_decimal_group()
    if words > 999 && !empty(separator)
      " Format number according to locale, e.g. German: 1.245 or English: 1,245
      let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g')
    endif
    let result = printf("%s%s", words, " words"). result
  else
    let result = printf("%s%s", words, "W"). result
  endif
  return result
endfunction

function! s:wordcount()
  if exists("*wordcount")
    let l:mode = mode()
    if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
      let l:visual_words = wordcount()['visual_words']
      if l:visual_words != ''
        return l:visual_words
      else
        return 0
      endif
    else
      return wordcount()['words']
    endif
  elseif mode() =~? 's'
    return
  else
    let old_status = v:statusmsg
    let position = getpos(".")
    exe "silent normal! g\<c-g>"
{'fraction_non_alphanumeric': 0.1590739357729649, 'fraction_numerical': 0.020537714712471993, 'mean_word_length': 3.1215384615384614, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 11, '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': '2890177', 'n_tokens_mistral': 988, 'n_tokens_neox': 919, 'n_words': 250}