Merge pull request #1012 from chrisbra/performance
Some improvements for the buflist implementation
This commit is contained in:
commit
cc219dbc10
|
@ -14,26 +14,24 @@ function! airline#extensions#tabline#buflist#list()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let buffers = []
|
let buffers = []
|
||||||
let cur = bufnr('%')
|
" If this is too slow, we can switch to a different algorithm.
|
||||||
|
" Basically branch 535 already does it, but since it relies on
|
||||||
|
" BufAdd autocommand, I'd like to avoid this if possible.
|
||||||
for nr in range(1, bufnr('$'))
|
for nr in range(1, bufnr('$'))
|
||||||
if buflisted(nr) && bufexists(nr)
|
if buflisted(nr)
|
||||||
let toadd = 1
|
" Do not add to the bufferlist, if either
|
||||||
for ex in s:excludes
|
" 1) buffername matches exclude pattern
|
||||||
if match(bufname(nr), ex) >= 0
|
" 2) buffer is a quickfix buffer
|
||||||
let toadd = 0
|
" 3) exclude preview windows (if 'bufhidden' == wipe
|
||||||
break
|
" and 'buftype' == nofile
|
||||||
|
if (!empty(s:excludes) && match(bufname(nr), join(s:excludes, '\|')) > -1) ||
|
||||||
|
\ (getbufvar(nr, 'current_syntax') == 'qf') ||
|
||||||
|
\ (s:exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
|
||||||
|
\ && getbufvar(nr, '&buftype') == 'nofile')
|
||||||
|
continue
|
||||||
endif
|
endif
|
||||||
endfor
|
|
||||||
if getbufvar(nr, 'current_syntax') == 'qf'
|
|
||||||
let toadd = 0
|
|
||||||
endif
|
|
||||||
if s:exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe' && getbufvar(nr, '&buftype') == 'nofile'
|
|
||||||
let toadd = 0
|
|
||||||
endif
|
|
||||||
if toadd
|
|
||||||
call add(buffers, nr)
|
call add(buffers, nr)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let s:current_buffer_list = buffers
|
let s:current_buffer_list = buffers
|
||||||
|
|
Loading…
Reference in New Issue