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

let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
let s:buf_modified_symbol = g:airline_symbols.modified

function! airline#extensions#tabline#init(ext)
  if has('gui_running')
    set guioptions-=e
  endif
  set showtabline=2
  set tabline=%!airline#extensions#tabline#get()

  call a:ext.add_theme_func('airline#extensions#tabline#load_theme')
endfunction

function! airline#extensions#tabline#load_theme(palette)
  call airline#highlighter#exec('airline_tab', a:palette.normal.airline_b)
  call airline#highlighter#exec('airline_tabsel', a:palette.normal.airline_a)
  call airline#highlighter#exec('airline_tabtype', a:palette.visual.airline_a)
  call airline#highlighter#exec('airline_tabfill', a:palette.normal.airline_c)
  call airline#highlighter#exec('airline_tabmod', a:palette.insert.airline_a)
endfunction

function! airline#extensions#tabline#get()
  if tabpagenr('$') == 1
    return s:get_buffers()
  else
    return s:get_tabs()
  endif
endfunction

function! airline#extensions#tabline#title(n)
  let buflist = tabpagebuflist(a:n)
  let winnr = tabpagewinnr(a:n)
  return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1])
endfunction

function! airline#extensions#tabline#get_buffer_name(nr)
  let _ = ''
  let name = bufname(a:nr)

  if s:buf_nr_show
    let _ .= printf(s:buf_nr_format, a:nr)
  endif

  if empty(name)
    let _ .= '[No Name]'
  else
    let _ .= fnamemodify(name, s:fmod)
  endif

  if getbufvar(a:nr, '&modified') == 1<commit_msg>support customizable tabline themes. resolves #212.<commit_after>" MIT License. Copyright (c) 2013 <NAME>.
" vim: et ts=2 sts=2 sw=2

let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
let s:buf_modified_symbol = g:airline_symbols.modified

function! airline#extensions#tabline#init(ext)
  if has('gui_running')
    set guioptions-=e
  endif
  set showtabline=2
  set tabline=%!airline#extensions#tabline#get()

  call a:ext.add_theme_func('airline#extensions#tabline#load_theme')
endfunction

function! airline#extensions#tabline#load_theme(palette)
  let l:tab = get(a:palette, 'airline_tab', a:palette.normal.airline_b)
  let l:tabsel = get(a:palette, 'airline_tabsel', a:palette.normal.airline_a)
  let l:tabtype = get(a:palette, 'airline_tabtype', a:palette.visual.airline_a)
  let l:tabfill = get(a:palette, 'airline_tabfill', a:palette.normal.airline_c)
  let l:tabmod = get(a:palette, 'airline_tabmod', a:palette.insert.airline_a)
  call airline#highlighter#exec('airline_tab', l:tab)
  call airline#highlighter#exec('airline_tabsel', l:tabsel)
  call airline#highlighter#exec('airline_tabtype', l:tabtype)
  call airline#highlighter#exec('airline_tabfill', l:tabfill)
  call airline#highlighter#exec('airline_tabmod', l:tabmod)
endfunction

function! airline#extensions#tabline#get()
  if tabpagenr('$') == 1
    return s:get_buffers()
  else
    return s:get_tabs()
  endif
endfunction

function! airline#extensions#tabline#title(n)
  let buflist = tabpagebuflist(a:n)
  let winnr = tabpagewinnr(a:n)
  return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1])
endfunction

function! airline#extensions#tabline#get_buffer_name(nr)
  let _ = ''
  let name = bufname(a:nr)

  if s:buf_nr_show
    let _ .= printf(s:buf_nr_format, a:nr)
  endif

  if empty(name)
    let _ .= '[No Name]'
  else
    let _ .= fnamemodify(name, s:fmod)
  endif

  if getbufvar(a:nr, '&modified') == 1
{'fraction_non_alphanumeric': 0.13924690422036898, 'fraction_numerical': 0.006823351023502654, 'mean_word_length': 6.496212121212121, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7645367', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1520, 'n_words': 261}