diff --git a/autoload/airline/extensions/tabline/buflist.vim b/autoload/airline/extensions/tabline/buflist.vim index 0c2bf31c..2670b737 100644 --- a/autoload/airline/extensions/tabline/buflist.vim +++ b/autoload/airline/extensions/tabline/buflist.vim @@ -44,6 +44,7 @@ function! airline#extensions#tabline#buflist#list() let exclude_buffers = get(g:, 'airline#extensions#tabline#exclude_buffers', []) let exclude_paths = get(g:, 'airline#extensions#tabline#excludes', []) let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1) + let CustomFilter = get(g:, 'airline#extensions#tabline#filter_function') let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$")) @@ -61,6 +62,8 @@ function! airline#extensions#tabline#buflist#list() " 'bufhidden' == wipe " 'buftype' == nofile " 5) ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat + " 6) airline#extensions#tabline#filter_function is defined and returns + " empty value " check buffer numbers first if index(exclude_buffers, nr) >= 0 @@ -74,6 +77,8 @@ function! airline#extensions#tabline#buflist#list() " check other types last elseif s:ExcludeOther(nr, exclude_preview) continue + elseif !empty(CustomFilter) && !call(CustomFilter, [nr]) + continue endif call add(buffers, nr) diff --git a/doc/airline.txt b/doc/airline.txt index 1cc99f61..c5690fc2 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -1446,6 +1446,10 @@ Note: Enabling this extension will modify 'showtabline' and 'guioptions'. (neovim specific, only works with buffers and not real tabs, default: 0) > let g:airline#extensions#tabline#middle_click_preserves_windows = 1 < +* custom buffer filter function (name of |Funcref|), takes buffer number and +* should return an empty value if a buffer shouldn't be displayed > + let airline#extensions#tabline#filter_function = '' + ------------------------------------- *airline-tabline-hlgroups* When the tabline is enabled, vim-airline exposes the following highlighting groups: