extract buffer name logic into a formatter.

hold off on deprecation warnings for now...
This commit is contained in:
Bailey Ling
2013-09-07 00:43:51 +00:00
parent 65efb89145
commit 0ac25ecc30
5 changed files with 49 additions and 40 deletions

View File

@@ -305,16 +305,6 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
* enable/disable displaying buffers with a single tab. >
let g:airline#extensions#tabline#show_buffers = 1
<
* defines a function for how to format the file name. >
" the default renders /foo/bar/file.txt => /f/b/file.txt
let g:airline#extensions#tabline#fnamefunc
" here's a simple example to show only the file name:
function! MyFileFormat(file)
return fnamemodify(a:file, ':t')
endfunction
let g:airline#extensions#tabline#fnamefunc = 'MyFileFormat'
<
* configure filename match rules to exclude from the tabline. >
let g:airline#extensions#tabline#excludes = []
<
@@ -322,12 +312,25 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
<
* defines the name of a formatter for how buffer names are displayed. >
let g:airline#extensions#tabline#formatter = 'default'
" here is how you can define a 'foo' formatter:
function! airline#extensions#tabline#formatters#foo(bufnr)
return fnamemodify(bufname(a:bufnr), ':t')
endfunction
let g:airline#extensions#tabline#formatter = 'foo'
<
* configure whether buffer numbers should be shown. >
let g:airline#extensions#tabline#buffer_nr_show = 0
<
Note: this is only valid when the formatter is 'default'.
* configure how buffer numbers should be formatted with |printf|. >
let g:airline#extensions#tabline#buffer_nr_format = '%s: '
<
Note: this is only valid when the formatter is 'default'.
* configure the minimum number of buffers needed to show the tabline. >
let g:airline#extensions#tabline#buffer_min_count = 0
<