Skip to content

tabline_buffers

Zeioth edited this page Mar 2, 2024 · 4 revisions

You can add this component to the tabline section of heirline opts.

require("heirline-components.all").component.tabline_conditional_padding()

It displays a indicator per opened buffer in the current tab. screenshot_2024-02-23_21-51-02_066527120

Clicking x, will close the specified buffer.

Integrations

If you have the plugin mini.bufremove installed, it will be used to decide what buffer will get the focus when you close a buffer. Otherwise, the behavior will be the default of Neovim.

Available providers

These are the available providers for this component and its options.

file_icon = {
  condition = function(self) return not self._show_picker end,
  hl = hl.file_icon "tabline",
},
filename = {},
filetype = false,
file_modified = {
  padding = { left = 1, right = 1 },
  condition = condition.is_file
},
unique_path = {
  hl = function(self) return hl.get_attributes(self.tab_type .. "_path") end,
},
close_button = {
  hl = function(self) return hl.get_attributes(self.tab_type .. "_close") end,
  padding = { left = 1, right = 1 },
  on_click = {
    callback = function(_, minwid) utils.close_buf(minwid) end,
    minwid = function(self) return self.bufnr end,
    name = "heirline_tabline_close_buffer_callback",
  },
},
padding = { left = 1, right = 1 },
hl = function(self)
  local tab_type = self.tab_type
  if self._show_picker and self.tab_type ~= "buffer_active" then
    tab_type = "buffer_visible"
  end
  return hl.get_attributes(tab_type)
end,
surround = false,

Examples

In this example we use the provider file_icon to disable the icon.

component.tabline_conditional_padding(file_icon = false)
Clone this wiki locally