Skip to content
Liu-Cheng Xu edited this page Apr 3, 2019 · 2 revisions
" The decoration of statusline was originally stealed from
" https://github.com/junegunn/dotfiles/blob/master/vimrc.
"
" %< Where to truncate
" %n buffer number
" %F Full path
" %m Modified flag: [+], [-]
" %r Readonly flag: [RO]
" %y Type:          [vim]
" fugitive#statusline()
" %= Separator
" %-14.(...)
" %l Line
" %c Column
" %V Virtual column
" %P Percentage
" %#HighlightGroup#

function! s:MyStatusLine()
  if has('gui_running')
      let l:buf_num = "%1* %n ❖ %{winnr()} %*"
  else
      let l:buf_num = "%1* %{S_buf_num()} ❖ %{winnr()} %*"
  endif
  let l:paste = "%#paste#%{&paste?'PASTE ':''}%*"
  let l:tot = '%2*[TOT:%{S_buf_total_num()}]%*'
  let l:fs = '%3* %{S_file_size(@%)} %*'
  let l:fp = '%4* %{S_full_path()} %*'
  let l:branch = '%6*%{S_fugitive()}%*'
  let l:gutter = '%{S_gitgutter()}'
  let l:ale_e = '%#ale_error#%{S_ale_error()}%*'
  let l:ale_w = '%#ale_warning#%{S_ale_warning()}%*'
  let l:tags = '%{S_gutentags()}'
  let l:m_r_f = '%7* %m%r%y %*'
  if s:font
    let l:pos = '%8* '. "\ue0a1 %l/%L:%c%V |"
  else
    let l:pos = '%8* %l/%L:%c%V |'
  endif
  let l:enc = " %{''.(&fenc!=''?&fenc:&enc).''} | %{(&bomb?\",BOM\":\"\")}"
  let l:ff = '%{&ff} %*'
  let l:pct = '%9* %P %*'

  return l:buf_num.l:paste.l:tot.'%<'.l:fs.l:fp.l:branch.l:gutter.l:ale_e.l:ale_w.
        \ '%='.l:tags.l:m_r_f.l:pos.l:enc.l:ff.l:pct
endfunction
Clone this wiki locally