mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-06-17 06:25:53 +08:00
tabline: add custom buffer filter function (#2752)
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user