Is there a way to hide tab/bufbar on initial nvim open, when only one buffer and file exists?
Closed this issue · 4 comments
unphased commented
The statusline and winbar both show the filename by default also, further reducing the utility of having it visible in this situation.
unphased commented
Sorry for making so many issues. I realize a couple of these could have been better placed in Discussions.
ghifarit53 commented
There's an option called showtabline
, and setting it to 1
might fit what you need. You can read more about it in :h 'showtabline'
rebelot commented
You can do something like this. Will probably add to the cookbook
-- from the cookbook
local buf_cache = {} -- this
local BufferLine = utils.make_buflist(
TablineBufferBlock,
{ provider = " ", hl = { fg = "gray" } },
{ provider = " ", hl = { fg = "gray" } }, nil,
buf_cache -- this
)
vim.api.nvim_create_autocmd({"BufAdd", "BufDelete"}, {
callback = function()
if #buf_cache > 1 then
vim.o.showtabline = 2
else
vim.o.showtabline = 1
end
end
})
rebelot commented
I apologise, the presented snippet does not fully work as intended.