-
Notifications
You must be signed in to change notification settings - Fork 4
tabline_conditional_padding
Zeioth edited this page Feb 23, 2024
·
5 revisions
You can add this component to the tabline section of heirline opts.
require("heirline-components.all").component.tabline_conditional_padding()
It applies padding under certain conditions. For example, given the next screenshot
If we open nerdtree, it will apply padding to the tab name:
These are the available providers for this component and its options.
-- If it returns 1 or more, add padding. If return false, don't.
condition = function(self)
self.winid = vim.api.nvim_tabpage_list_wins(0)[1]
local pattern = (opts and opts.pattern) or {
filetype = { "aerial", "dapui_.", "dap%-repl", "neo%-tree", "NvimTree", "edgy" },
buftype = {}
}
return condition.buffer_matches(
pattern,
vim.api.nvim_win_get_buf(self.winid)
)
end,
-- Amount of padding is self-caltulated based on the opened panel.
provider = function(self)
return string.rep(" ", vim.api.nvim_win_get_width(self.winid) + 1)
end,
hl = { bg = "tabline_bg" },
For example you could change the condition with
component.tabline_conditional_padding({ condition = function() end })
Or how the padding is applied with
component.tabline_conditional_padding({ provider = function() end })
Or the background color of the padding with
component.tabline_conditional_padding({ bg = "#777777" })