Skip to content

Commit d42c56c

Browse files
folliehiyukiwillothy
authored andcommitted
feat: add fill_hl config option
Make the colors of the filler space configurable.
1 parent 3353afc commit d42c56c

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,9 @@ require('cokeline').setup({
562562
style = 'attr1,attr2,...' | function(buffer) -> 'attr1,attr2,...',
563563
},
564564

565+
-- The highlight group used to fill the tabline space
566+
fill_hl = 'TabLineFill',
567+
565568
-- A list of components to be rendered for each buffer. Check out the section
566569
-- below explaining what this value can be set to.
567570
-- default: see `/lua/cokeline/defaults.lua`

doc/cokeline.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ The valid keys are:
112112
style = 'attr1,attr2,...' | function(buffer) -> 'attr1,attr2,...',
113113
},
114114

115+
-- The highlight group used to fill the tabline space
116+
fill_hl = 'TabLineFill',
115117

116118
-- A list of components to be rendered for each buffer (see
117119
-- |cokeline-components|).

lua/cokeline/config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ local defaults = {
4444
style = "NONE",
4545
},
4646

47+
fill_hl = 'TabLineFill',
48+
4749
---@type Component[]
4850
components = {
4951
{

lua/cokeline/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ _G.cokeline.tabline = function()
5757
opt.showtabline = 0
5858
return
5959
end
60-
return rendering.render(visible_buffers)
60+
return rendering.render(visible_buffers, _G.cokeline.config.fill_hl)
6161
end
6262

6363
return {

lua/cokeline/rendering.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ end
8989
---the list of visible buffers, figures out which components to display, and
9090
---returns a list of pre-render components
9191
---@param visible_buffers Buffer[]
92-
---@return string
92+
---@return table|string
9393
local prepare = function(visible_buffers)
9494
local sidebar_components = sidebar.get_components()
9595
local rhs_components = rhs.get_components()
@@ -178,15 +178,16 @@ end
178178
---the list of visible buffers, figures out which components to display and
179179
---returns their rendered version.
180180
---@param visible_buffers Buffer[]
181+
---@param fill_hl string
181182
---@return string
182-
local render = function(visible_buffers)
183+
local render = function(visible_buffers, fill_hl)
183184
local cx = prepare(visible_buffers)
184185
return components.render(cx.sidebar)
185186
.. components.render(cx.buffers)
186-
.. "%#TabLine#"
187+
.. "%#" .. fill_hl .. "#"
187188
.. string.rep(" ", cx.gap)
188189
.. components.render(cx.rhs)
189-
.. "%#TabLine#"
190+
.. "%#" .. fill_hl .. "#"
190191
end
191192

192193
return {

0 commit comments

Comments
 (0)