nanozuki/tabby.nvim

How to handle too many tabs

Closed this issue · 1 comments

Hi.
Before anything, thank you for this amazing plugin!

My question is related to having many tabs (which is something I run into from time to time). For example when I'm getting close to the max width of my terminal it looks like this:
image

When the whole tabline width exceeds the terminal width, it hides some information on the left
image

If I select the left-most tab, it keeps hiding some tab info
image

and if I keep creating more tabs and the selected tab happens to be the left-most tab, than it's hidden completely
image

My config is (using lazy.nvim):

return {
  {
    "nanozuki/tabby.nvim",
    dependencies = {
      { "folke/tokyonight.nvim" },
    },
    config = function()
      local colors = require("tokyonight.colors").setup()
      local theme = {
        fill = "TabLineFill",
        current_tab = { fg = colors.black, bg = colors.blue, style = "bold" },
        tab = { style = "italic" },
      }
      require("tabby.tabline").set(function(line)
        return {
          line.spacer(),
          line.tabs().foreach(function(tab)
            local hl = tab.is_current() and theme.current_tab or theme.tab
            return {
              line.sep(tab.is_current() and "" or "", hl, theme.fill),
              tab.number(),
              string.gsub(tab.name(), "%[..%]", ""),
              line.sep(tab.is_current() and "" or "", hl, theme.fill),
              hl = hl,
              margin = " ",
            }
          end),
          line.spacer(),
        }
      end)
    end,
  },
}

Is there any option I can use when setting up the plugin that let me cycle through all the tabs and keep the selected one visible on screen? (sorry if it's a dumb question or the answer is obvious. I'm still learning neovim and Lua)

Currently, you can use line.truncate_point() to specify where to truncate the line.