<commit_before>let g:lightline = {
    \ 'colorscheme': 'seoul256',
    \ 'mode_map': {
    \   'c': 'NORMAL'
    \ },
    \ 'active': {
    \   'left': [
    \     [ 'mode', 'paste' ],
    \     [ 'gitbranch', 'filename' ]
    \   ],
    \   'right': [
    \     [ 'lineinfo' ],
    \     [ 'percent' ],
    \     [ 'fileformat', 'fileencoding', 'filetype' ]
    \   ]
    \ },
    \ 'component_function': {
    \   'gitbranch': 'LightlineGitBranch',
    \   'filename': 'LightlineFileName',
    \   'fileformat': 'LightlineFileFormat',
    \   'filetype': 'LightlineFileType',
    \   'fileencoding': 'LightlineFileEncoding',
    \   'mode': 'LightlineMode'
    \ },
    \ 'separator': {
    \   'left': '',
    \   'right': ''
    \ },
    \ 'subseparator': {
    \   'left': '',
    \   'right': ''
    \ }
    \ }

let g:lightline.tab = {
    \ 'active': [
    \   'tabnum',
    \   'lightlinetabname',
    \   'lightlinetabmodified'
    \ ],
    \ 'inactive': [
    \   'tabnum',
    \   'lightlinetabname',
    \   'lightlinetabmodified'
    \ ]
    \ }

let g:lightline.tab_component_function = {
    \ 'lightlinetabname': 'LightlineTabName',
    \ 'lightlinetabmodified': 'LightlineTabModified',
    \ 'readonly': 'lightline#tab#readonly',
    \ 'tabnum': 'lightline#tab#tabnum'
    \ }

function! LightlineModified()
  try
    if &modified == 1
      return '+'
    else
      return ''
    endif
  catch
  endtry
  return ''
endfunction

function! LightlineReadOnly()
  try
    if &readonly
      return ''
    endif
  catch
  endtry
  return ''
endfunction

function! LightlineFileName()
  return
    \ ('' != LightlineReadOnly() ? LightlineReadOnly() . ' ' : '') .
    \ (&ft == 'undotree' ? '' :
    \  &ft == 'vim-plug' ? '' :
    \  '' != expand('%:t') ? expand('%:t') : '[No Name]') .
    \ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
endfunction

function! GitBranch() abort
  if !exists('b:git_branch')
    let b:git_branch = system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
  endif
  return b:git_branch
endfunction

" refresh git branch periodically
augroup gitbranch
  autocmd!
  autocmd BufEnter,BufWritePost,CursorHold,CursorHoldI,FocusGained <buffer>
    \ silent! unlet b:git_branch
augroup END

function! LightlineGitBranch()
  try
    let _ = GitBranch()
    return strlen(_) ? ' ' . _ : ''
  catch
  endtry
  return ''
endfunction

function! LightlineFileFormat()
  return winwidth(0) > 70 ? &fileformat : ''
endfunction

function! LightlineFileType()
  return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction<commit_msg>replace unix pipe with comparable vim cmd<commit_after>let g:lightline = {
    \ 'colorscheme': 'seoul256',
    \ 'mode_map': {
    \   'c': 'NORMAL'
    \ },
    \ 'active': {
    \   'left': [
    \     [ 'mode', 'paste' ],
    \     [ 'gitbranch', 'filename' ]
    \   ],
    \   'right': [
    \     [ 'lineinfo' ],
    \     [ 'percent' ],
    \     [ 'fileformat', 'fileencoding', 'filetype' ]
    \   ]
    \ },
    \ 'component_function': {
    \   'gitbranch': 'LightlineGitBranch',
    \   'filename': 'LightlineFileName',
    \   'fileformat': 'LightlineFileFormat',
    \   'filetype': 'LightlineFileType',
    \   'fileencoding': 'LightlineFileEncoding',
    \   'mode': 'LightlineMode'
    \ },
    \ 'separator': {
    \   'left': '',
    \   'right': ''
    \ },
    \ 'subseparator': {
    \   'left': '',
    \   'right': ''
    \ }
    \ }

let g:lightline.tab = {
    \ 'active': [
    \   'tabnum',
    \   'lightlinetabname',
    \   'lightlinetabmodified'
    \ ],
    \ 'inactive': [
    \   'tabnum',
    \   'lightlinetabname',
    \   'lightlinetabmodified'
    \ ]
    \ }

let g:lightline.tab_component_function = {
    \ 'lightlinetabname': 'LightlineTabName',
    \ 'lightlinetabmodified': 'LightlineTabModified',
    \ 'readonly': 'lightline#tab#readonly',
    \ 'tabnum': 'lightline#tab#tabnum'
    \ }

function! LightlineModified()
  try
    if &modified == 1
      return '+'
    else
      return ''
    endif
  catch
  endtry
  return ''
endfunction

function! LightlineReadOnly()
  try
    if &readonly
      return ''
    endif
  catch
  endtry
  return ''
endfunction

function! LightlineFileName()
  return
    \ ('' != LightlineReadOnly() ? LightlineReadOnly() . ' ' : '') .
    \ (&ft == 'undotree' ? '' :
    \  &ft == 'vim-plug' ? '' :
    \  '' != expand('%:t') ? expand('%:t') : '[No Name]') .
    \ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
endfunction

function! GitBranch() abort
  if !exists('b:git_branch')
    let b:git_branch = substitute(strtrans(system("git rev-parse --abbrev-ref HEAD 2>/dev/null")),'\^@','','g')
  endif
  return b:git_branch
endfunction

" refresh git branch periodically
augroup gitbranch
  autocmd!
  autocmd BufEnter,BufWritePost,CursorHold,CursorHoldI,FocusGained <buffer>
    \ silent! unlet b:git_branch
augroup END

function! LightlineGitBranch()
  try
    let _ = GitBranch()
    return strlen(_) ? ' ' . _ : ''
  catch
  endtry
  return ''
endfunction

function! LightlineFileFormat()
  return winwidth(0) > 70 ? &fileformat : ''
endfunction

function! LightlineFileType()
  return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
{'fraction_non_alphanumeric': 0.17712665406427222, 'fraction_numerical': 0.004158790170132325, 'mean_word_length': 2.458169934640523, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4101658', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1908, 'n_words': 336}