tabline-framework.nvim
tabline-framework.nvim copied to clipboard
How to show tabline with only one tab
How to show buffers in tabline, when only one tab is opened?
I use tabline_framework.toys and do not know how to do this.
Do you mean that tabline is not showing when there is only one tab?
In that case, you can set nvim to always show tabline by setting vim.opt.showtabline = 2
Or is there another error? Could you provide some more details, your config, maybe screenshot if that's not it?
@rafcamlet yes, but in my case prefer to show tabline is only one tab and when buffers more than one
when nvim just opened, do not show tabline. If then open more buffers or create a tab, it must shown
Hi @javeoff ! Wow, it took me a while to get back. I'm trying, but unfortunately, I'm still not sure what you mean. If you are still interested in getting help with the problem, please describe it step by step in more detail.
I know it's almost a year after the last reply, but:
vim.api.nvim_create_autocmd(
{ "VimEnter", "BufNew", "BufReadPost", "BufDelete", "BufWipeout" },
{
callback = function()
vim.defer_fn(function()
local getCount = function()
local result =
vim.api.nvim_exec2("ls", { output = true })
local count = 1
for _ in string.gmatch(result.output, "\n") do
count = count + 1
end
return count
end
print(getCount())
if getCount() <= 1 then
vim.cmd("set showtabline=0")
else
vim.cmd("set showtabline=2")
end
end, 1)
end,
}
)
Does what @javeoff wants, I believe. I just threw this in the config function for tabline-framework and it seems to work alright. Hides tabline if only one buffer, shows tabline if there's more than one.