nanozuki / tabby.nvim

A declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
MIT License
570 stars 20 forks source link

[Feature Request] Option to show tabline only if there are 'n' tabs open #32

Closed luiz00martins closed 2 years ago

luiz00martins commented 2 years ago

Currently, tabby will show the tabline even when there's only one tab open. It'd be nice if you had the option to show it only when there are multiple tabs open, the same way it works with the vanilla one.

I think this could be implemented as an option like show_when_n_or_more_tabs. With the default 1, it'd always show the tabline. However when changed to 2, it'd only show the tabline when you have 2 or more tabs open, and changing to 3 would only show when there are 3 or more open.

nanozuki commented 2 years ago

Oh..I think this is necessary, but I missed it. I will add this for the next version.

CsYakamoz commented 2 years ago

Temporary solution: override showtabline after calling setup

require('tabby').setup({
    -- your config
})

vim.cmd([[set showtabline=1]])
-- or
vim.o.showtabline = 1

but my expected solution is:

require("tabby").setup({
    tabline = presets.tab_only,
    showtabline = 1, -- default to 2
})

and change init function logic to:

function tabby.init()
-  vim.o.showtabline = 2
+  vim.o.showtabline  = tabby_opt.showtabline or 2
  vim.o.tabline = '%!TabbyTabline()'
end
CsYakamoz commented 2 years ago

oh, sorry, this doesn't implement his request

nanozuki commented 2 years ago

@luiz00martins Now you can use

{
  opt = {
    show_at_least = n,
  },
}

to reach your goal.