Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BufTabLineHiddenAlt highlight group for easier legibility #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/buftabline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ The highlight groups and their default links are as follows:
*BufTabLineCurrent* |TabLineSel| Buffer shown in current window
*BufTabLineActive* |PmenuSel| Buffer shown in other window
*BufTabLineHidden* |TabLine| Buffer not currently visible
*BufTabLineHiddenAlt* |TabLineFill| Buffer not currently visible,
alternative color
*BufTabLineFill* |TabLineFill| Empty area


Expand Down
15 changes: 9 additions & 6 deletions plugin/buftabline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ scriptencoding utf-8
augroup BufTabLine
autocmd!

hi default link BufTabLineCurrent TabLineSel
hi default link BufTabLineActive PmenuSel
hi default link BufTabLineHidden TabLine
hi default link BufTabLineFill TabLineFill
hi default link BufTabLineCurrent TabLineSel
hi default link BufTabLineActive PmenuSel
hi default link BufTabLineHidden TabLine
hi default link BufTabLineHiddenAlt TabLineFill
hi default link BufTabLineFill TabLineFill

let g:buftabline_numbers = get(g:, 'buftabline_numbers', 0)
let g:buftabline_indicators = get(g:, 'buftabline_indicators', 0)
Expand Down Expand Up @@ -64,10 +65,11 @@ function! buftabline#render()
let tabs_per_tail = {}
let currentbuf = winbufnr(0)
let screen_num = 0
let ordinal_num = 0
for bufnum in bufnums
let screen_num = show_num ? bufnum : show_ord ? screen_num + 1 : ''
let screen_num = show_num ? bufnum : show_ord ? ordinal_num : ''
let tab = { 'num': bufnum }
let tab.hilite = currentbuf == bufnum ? 'Current' : bufwinnr(bufnum) > 0 ? 'Active' : 'Hidden'
let tab.hilite = currentbuf == bufnum ? 'Current' : bufwinnr(bufnum) > 0 ? 'Active' : ordinal_num % 2 == 0 ? 'Hidden' : 'HiddenAlt'
if currentbuf == bufnum | let [centerbuf, s:centerbuf] = [bufnum, bufnum] | endif
let bufpath = bufname(bufnum)
if strlen(bufpath)
Expand All @@ -85,6 +87,7 @@ function! buftabline#render()
\ . ( screen_num ? screen_num : '*' )
endif
let tabs += [tab]
let ordinal_num = ordinal_num+1
endfor

" disambiguate same-basename files by adding trailing path segments
Expand Down