mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-01-04 02:23:22 +08:00
tabline: allow to show current buffer/tab at first position
This will make highlighting more consistent. Always first item is the one where the cursor is.
This commit is contained in:
@@ -111,6 +111,12 @@ endfunction
|
||||
function! s:get_visible_buffers()
|
||||
let buffers = airline#extensions#tabline#buflist#list()
|
||||
let cur = bufnr('%')
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
if index(buffers, cur) > -1
|
||||
call remove(buffers, index(buffers, cur))
|
||||
endif
|
||||
let buffers = [cur] + buffers
|
||||
endif
|
||||
|
||||
let total_width = 0
|
||||
let max_width = 0
|
||||
|
||||
@@ -43,7 +43,15 @@ function! airline#extensions#tabline#tabs#get()
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
call airline#extensions#tabline#add_label(b, 'tabs')
|
||||
for i in range(1, tabpagenr('$'))
|
||||
" always have current tabpage first
|
||||
let tablist = range(1, tabpagenr('$'))
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
if index(tablist, curtab) > -1
|
||||
call remove(tablist, index(tablist, curtab))
|
||||
endif
|
||||
let tablist = [curtab] + tablist
|
||||
endif
|
||||
for i in tablist
|
||||
if i == curtab
|
||||
let group = 'airline_tabsel'
|
||||
if g:airline_detect_modified
|
||||
|
||||
Reference in New Issue
Block a user