2013-09-07 08:43:51 +08:00
|
|
|
" MIT License. Copyright (c) 2013 Bailey Ling.
|
|
|
|
" vim: et ts=2 sts=2 sw=2
|
|
|
|
|
2013-09-07 09:36:15 +08:00
|
|
|
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
|
2013-09-07 08:43:51 +08:00
|
|
|
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
|
|
|
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
|
|
|
let s:buf_modified_symbol = g:airline_symbols.modified
|
|
|
|
|
2013-09-07 08:51:58 +08:00
|
|
|
function! airline#extensions#tabline#formatters#default(bufnr, buffers)
|
2013-09-07 08:43:51 +08:00
|
|
|
let _ = ''
|
|
|
|
|
|
|
|
if s:buf_nr_show
|
|
|
|
let _ .= printf(s:buf_nr_format, a:bufnr)
|
|
|
|
endif
|
|
|
|
|
|
|
|
let name = bufname(a:bufnr)
|
|
|
|
if empty(name)
|
|
|
|
let _ .= '[No Name]'
|
|
|
|
else
|
2013-09-07 09:36:15 +08:00
|
|
|
let _ .= substitute(fnamemodify(name, s:fmod), '\w\zs.\{-}\ze\/', '', 'g')
|
2013-09-07 08:43:51 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
if getbufvar(a:bufnr, '&modified') == 1
|
|
|
|
let _ .= s:buf_modified_symbol
|
|
|
|
endif
|
|
|
|
|
|
|
|
return _
|
|
|
|
endfunction
|
|
|
|
|