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:
parent
30652c05c4
commit
9d28f0dcc7
|
@ -111,6 +111,12 @@ endfunction
|
||||||
function! s:get_visible_buffers()
|
function! s:get_visible_buffers()
|
||||||
let buffers = airline#extensions#tabline#buflist#list()
|
let buffers = airline#extensions#tabline#buflist#list()
|
||||||
let cur = bufnr('%')
|
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 total_width = 0
|
||||||
let max_width = 0
|
let max_width = 0
|
||||||
|
|
|
@ -43,7 +43,15 @@ function! airline#extensions#tabline#tabs#get()
|
||||||
let b = airline#extensions#tabline#new_builder()
|
let b = airline#extensions#tabline#new_builder()
|
||||||
|
|
||||||
call airline#extensions#tabline#add_label(b, 'tabs')
|
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
|
if i == curtab
|
||||||
let group = 'airline_tabsel'
|
let group = 'airline_tabsel'
|
||||||
if g:airline_detect_modified
|
if g:airline_detect_modified
|
||||||
|
|
|
@ -698,6 +698,10 @@ with the middle mouse button to delete that buffer.
|
||||||
* rename label for tabs (default: 'tabs') (c) >
|
* rename label for tabs (default: 'tabs') (c) >
|
||||||
let g:airline#extensions#tabline#tabs_label = 't'
|
let g:airline#extensions#tabline#tabs_label = 't'
|
||||||
|
|
||||||
|
* always show current tabpage/buffer first >
|
||||||
|
let airline#extensions#tabline#current_first = 1
|
||||||
|
< default: 0
|
||||||
|
|
||||||
* enable/disable displaying index of the buffer.
|
* enable/disable displaying index of the buffer.
|
||||||
|
|
||||||
When enabled, numbers will be displayed in the tabline and mappings will be
|
When enabled, numbers will be displayed in the tabline and mappings will be
|
||||||
|
|
Loading…
Reference in New Issue