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

let s:ext = {}
function! s:ext.add_statusline_func(name) dict
  call airline#add_statusline_func(a:name)
endfunction
function! s:ext.add_statusline_funcref(function) dict
  call airline#add_statusline_funcref(a:function)
endfunction
function! s:ext.add_inactive_statusline_func(name) dict
  call airline#add_inactive_statusline_func(a:name)
endfunction

let s:script_path = expand('<sfile>:p:h')

let s:filetype_overrides = {
      \ 'netrw': [ 'netrw', '%f' ],
      \ 'nerdtree': [ 'NERD', '' ],
      \ 'gundo': [ 'Gundo', '' ],
      \ 'diff': [ 'diff', '' ],
      \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
      \ 'minibufexpl': [ 'MiniBufExplorer', '' ],
      \ 'startify': [ 'startify', '' ],
      \ }

let s:filetype_regex_overrides = {}

function! s:check_defined_section(name)
  if !exists('w:airline_section_{a:name}')
    if g:airline_section_{a:name} == '__'
      let w:airline_section_{a:name} = ''
    else
      let w:airline_section_{a:name} = g:airline_section_{a:name}
    endif
  endif
endfunction

function! airline#extensions#append_to_section(name, value)
  call <sid>check_defined_section(a:name)
  let w:airline_section_{a:name} .= a:value
endfunction

function! airline#extensions#prepend_to_section(name, value)
  call <sid>check_defined_section(a:name)
  let w:airline_section_{a:name} = a:value . w:airline_section_{a:name}
endfunction

function! airline#extensions#apply_left_override(section1, section2)
  let w:airline_section_a = a:section1
  let w:airline_section_b = a:section2
  let w:airline_section_c = ''
  let w:airline_render_left = 1
  let w:airline_render_right = 0
endfunction

let s:active_winnr = -1
function! airline#extensions#update_statusline(...)
  if s:is_excluded_window(a:000)
    return -1
  endif

  let s:active_winnr = winnr()

  if &buftype == 'quickfix'
    let w:airline_section_a = 'Quickfix'
    let w:airline_section_b = ''
    let w:airline_section_c = ''
    let w:airline_section_x = ''
  elseif &buftype == 'help'
    call airline#extensions#apply_left_override('Help', '%f')
    let w:airline_section_x = ''
    let w:airline_section_y = ''
    let w:airline_render_right = 1
  endif

  if &previewwindow
    let w:airline_section_a = 'Preview'
    let w:airline_section_b = ''
    let w:airline_section_c = bufname(winbufnr(winnr()))
  endif

  if has_key(s:filetype_overrides, &ft)
    let args = s:filetype_overrides[&ft]
    call airline#extensions#apply_left_override(args[0], args[1])
  endif

  for item in items(s:filetype_regex_overrides)
    if match(&ft, item[0]) >= 0
      call airline#extensions#apply_left_override(item[1][0], item[1][1])
    endif
  endfor
endfunction

function! s:is_excluded_window(...)
  for matchft in g:airline_exclude_filetypes
    if matchft ==# &ft
      return 1
    endif<commit_msg>remove redundant args.<commit_after>" MIT License. Copyright (c) 2013 <NAME>.
" vim: et ts=2 sts=2 sw=2

let s:ext = {}
function! s:ext.add_statusline_func(name) dict
  call airline#add_statusline_func(a:name)
endfunction
function! s:ext.add_statusline_funcref(function) dict
  call airline#add_statusline_funcref(a:function)
endfunction
function! s:ext.add_inactive_statusline_func(name) dict
  call airline#add_inactive_statusline_func(a:name)
endfunction

let s:script_path = expand('<sfile>:p:h')

let s:filetype_overrides = {
      \ 'netrw': [ 'netrw', '%f' ],
      \ 'nerdtree': [ 'NERD', '' ],
      \ 'gundo': [ 'Gundo', '' ],
      \ 'diff': [ 'diff', '' ],
      \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
      \ 'minibufexpl': [ 'MiniBufExplorer', '' ],
      \ 'startify': [ 'startify', '' ],
      \ }

let s:filetype_regex_overrides = {}

function! s:check_defined_section(name)
  if !exists('w:airline_section_{a:name}')
    if g:airline_section_{a:name} == '__'
      let w:airline_section_{a:name} = ''
    else
      let w:airline_section_{a:name} = g:airline_section_{a:name}
    endif
  endif
endfunction

function! airline#extensions#append_to_section(name, value)
  call <sid>check_defined_section(a:name)
  let w:airline_section_{a:name} .= a:value
endfunction

function! airline#extensions#prepend_to_section(name, value)
  call <sid>check_defined_section(a:name)
  let w:airline_section_{a:name} = a:value . w:airline_section_{a:name}
endfunction

function! airline#extensions#apply_left_override(section1, section2)
  let w:airline_section_a = a:section1
  let w:airline_section_b = a:section2
  let w:airline_section_c = ''
  let w:airline_render_left = 1
  let w:airline_render_right = 0
endfunction

let s:active_winnr = -1
function! airline#extensions#update_statusline(...)
  if s:is_excluded_window()
    return -1
  endif

  let s:active_winnr = winnr()

  if &buftype == 'quickfix'
    let w:airline_section_a = 'Quickfix'
    let w:airline_section_b = ''
    let w:airline_section_c = ''
    let w:airline_section_x = ''
  elseif &buftype == 'help'
    call airline#extensions#apply_left_override('Help', '%f')
    let w:airline_section_x = ''
    let w:airline_section_y = ''
    let w:airline_render_right = 1
  endif

  if &previewwindow
    let w:airline_section_a = 'Preview'
    let w:airline_section_b = ''
    let w:airline_section_c = bufname(winbufnr(winnr()))
  endif

  if has_key(s:filetype_overrides, &ft)
    let args = s:filetype_overrides[&ft]
    call airline#extensions#apply_left_override(args[0], args[1])
  endif

  for item in items(s:filetype_regex_overrides)
    if match(&ft, item[0]) >= 0
      call airline#extensions#apply_left_override(item[1][0], item[1][1])
    endif
  endfor
endfunction

function! s:is_excluded_window()
  for matchft in g:airline_exclude_filetypes
    if matchft ==# &ft
      return 1
    endif
{'fraction_non_alphanumeric': 0.13400997763633235, 'fraction_numerical': 0.009117495269224153, 'mean_word_length': 4.6611489776046735, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '1532074', 'n_tokens_mistral': 2224, 'n_tokens_neox': 2163, 'n_words': 387}