ap / vim-buftabline

Forget Vim tabs – now you can have buffer tabs
http://www.vim.org/scripts/script.php?script_id=5057
MIT License
782 stars 75 forks source link

What's the colorscheme or color configs for the image in README doc? #87

Closed wanaiqing closed 1 year ago

wanaiqing commented 1 year ago

It seems that I can't get the same effect in vim with gruvbox. This is mine. mine This is yours(what I want). yours

Can you please share it?

ap commented 1 year ago

Certainly. The screenshot is generated from the stuff committed on the assets branch. The colorscheme is lucius, specifically the version committed on that branch.


You don’t need to switch colorschemes over just this btw.

The way the whole highlighting mechanism works in Vim is that syntaxes and plugins define names for things of some particular identity (like javascriptString or whatever), then link this name to one of the common names used in the builtin Vim colorschemes like String or Comment, which you can browse by doing :help highlight-groups. The colorscheme then actually defines specific colors for these generic names. (And maybe for plugin- and/or syntax-specific names!)

Buftabline defines a number of custom names, which are documented in :help buftabline-colors.

Now if you look at the default group names, you will find that Buftabline has a problem, because the default tabline only has two different states to highlight – either a tab is active or it’s not – so there are only two color names defined for tabs. But Buftabline has three states to show: a buffer can be in the focused window, or some other window, or not in any window. So two are covered, but I had to pick something entirely different for the third state. For that I settled on PmenuSel, which is the color of the selection within an in-window textual popup menu, which seemed like it was most likely to work well in most colorschemes, by the nature of what the name is for.

But apparently gruvbox makes that the same color as TabLine. Womp womp…

So the bottom line is, you browse :help highlight-group (where the name of each highlight group is helpfully highlighted by itself), pick one that makes sense, and put hi link BufTabLineActive ThatOtherGroup in your vimrc.


Does that cover all questions?

wanaiqing commented 1 year ago

Certainly. The screenshot is generated from the stuff committed on the assets branch. The colorscheme is lucius, specifically the version committed on that branch.

You don’t need to switch colorschemes over just this btw.

The way the whole highlighting mechanism works in Vim is that syntaxes and plugins define names for things of some particular identity (like javascriptString or whatever), then link this name to one of the common names used in the builtin Vim colorschemes like String or Comment, which you can browse by doing :help highlight-groups. The colorscheme then actually defines specific colors for these generic names. (And maybe for plugin- and/or syntax-specific names!)

Buftabline defines a number of custom names, which are documented in :help buftabline-colors.

Now if you look at the default group names, you will find that Buftabline has a problem, because the default tabline only has two different states to highlight – either a tab is active or it’s not – so there are only two color names defined for tabs. But Buftabline has three states to show: a buffer can be in the focused window, or some other window, or not in any window. So two are covered, but I had to pick something entirely different for the third state. For that I settled on PmenuSel, which is the color of the selection within an in-window textual popup menu, which seemed like it was most likely to work well in most colorschemes, by the nature of what the name is for.

But apparently gruvbox makes that the same color as TabLine. Womp womp…

So the bottom line is, you browse :help highlight-group (where the name of each highlight group is helpfully highlighted by itself), pick one that makes sense, and put hi link BufTabLineActive ThatOtherGroup in your vimrc.

Does that cover all questions?

Colors are great in your featured lucius theme, thanks.

wanaiqing commented 1 year ago

@ap find out that gruvbox specifically set highlight groups for buftabline

ap commented 1 year ago

Nice! That’s one of the reasons I defined these custom names, so that colorschemes can directly target Buftabline specifically if they wish. It’s nice to see a colorscheme taking advantage of that. Looking at the code, it seems to use distinct colors for the three states as it should, so it should have worked for you… but it didn’t. Strange!