Statusline & tabufline

We use our own plugin for statusline and tabufline. The default config is (keep in mind that every plugin's default config is just a table):

M.ui = {
  -- ...other options

  statusline = {
    theme = "default", -- default/vscode/vscode_colored/minimal

    -- default/round/block/arrow (separators work only for "default" statusline theme;
    -- round and block will work for the minimal theme only)
    separator_style = "default",
    overriden_modules = nil,
  },

  tabufline = {
    lazyload = true,
    overriden_modules = nil,
  },

  -- ...other options
}

Override statusline modules

  • To override default list of statusline modules, you need to check their indexes in the modules table our statusline modules file
  • you can either define a function outside or just define & run it right away like below :
M.ui = {
  statusline = {
    -- modules arg here is the default table of modules
    overriden_modules = function(modules)
      modules[1] = (function()
        return "MODE!"
      end)()

      -- define the somefunction anywhwere in your custom dir, just call it well!
      -- modules[2] = somefunction()  

      -- adding a module between 2 modules
      -- Use the table.insert functin to insert at specific index
      -- This will insert a new module at index 2 and previous index 2 will become 3 now

      table.insert(
        modules,
        2,
        (function()
          return " between mode and filename ! "
        end)()
      )
    end,
  },
}

  • To highlight a string in statusline, wrap it with your highlight group:
"%#BruhHl#" .. " bruh " -- the highlight group here is BruhHl

Override tabufline modules

The configuration for overriding tabufline is the same as in statusline:

  • Below code will add a new module at last index and removes module at index 1.
  • The module at index 1 was previously nvimtree offset module which means it'll be shown on leftside of tabufline.
  • The below code for those using nvimtree on the right side and want the offset on right.
M.ui = {
  tabufline = {
    overriden_modules = function(modules)
       table.insert(modules, modules[1])
       table.remove(modules,1)
      -- or modules[1] = ""
    end,
  },
}

Again, check the list of modules in our tabufline modules file.