Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to hide tab/bufbar on initial nvim open, when only one buffer and file exists? #122

Closed
unphased opened this issue Mar 2, 2023 · 4 comments · Fixed by #157

Comments

@unphased
Copy link

unphased commented Mar 2, 2023

The statusline and winbar both show the filename by default also, further reducing the utility of having it visible in this situation.

@unphased
Copy link
Author

unphased commented Mar 2, 2023

Sorry for making so many issues. I realize a couple of these could have been better placed in Discussions.

@ghifarit53
Copy link

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
Copy link
Owner

rebelot commented Mar 6, 2023

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 rebelot closed this as completed in f533bbd Mar 6, 2023
@rebelot rebelot reopened this Mar 6, 2023
@rebelot
Copy link
Owner

rebelot commented Mar 6, 2023

I apologise, the presented snippet does not fully work as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants