allow collapsing to be configurable. also fix win paths.

This commit is contained in:
Bailey Ling 2013-09-07 15:09:19 +00:00
parent e1062c5f84
commit dbd9121c05
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@
" vim: et ts=2 sts=2 sw=2
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
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
@ -17,7 +18,11 @@ function! airline#extensions#tabline#formatters#default(bufnr, buffers)
if empty(name)
let _ .= '[No Name]'
else
let _ .= substitute(fnamemodify(name, s:fmod), '\w\zs.\{-}\ze\/', '', 'g')
if s:fnamecollapse
let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
else
let _ .= fnamemodify(name, s:fmod)
endif
endif
if getbufvar(a:bufnr, '&modified') == 1

View File

@ -331,6 +331,9 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
<
* configure the formatting of filenames (see |filename-modifiers|). >
let g:airline#extensions#tabline#fnamemod = ':p:.'
<
* configure collapsing parent directories in buffer name. >
let g:airline#extensions#tabline#fnamecollapse = 1
<
* configure the minimum number of buffers needed to show the tabline. >
let g:airline#extensions#tabline#buffer_min_count = 0