goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.82k stars 109 forks source link

The option `showtabline` is overwritten by Alpha #116

Closed AxZxP closed 2 years ago

AxZxP commented 2 years ago

Setup

How to reproduce

in my option I've set : vim.opt.showtabline = 0. If I open a file without transiting by Alpha dashboard I don't have any tabline. If I open the dashboard first and open a file I have this tabline.

Screen https://user-images.githubusercontent.com/68596777/174447460-44b2c910-e488-42b4-b953-05016ef3fe08.mp4

Is there a way for Alpha to honour this setting ?

goolord commented 2 years ago

alpha does not overwrite showtabline. what you're probably experiencing here is that the tabline will not show tabs for hidden or unlisted buffers, and if alpha is the only buffer open, then there are no unhidden or listed buffers to display in the tabline.

goolord commented 2 years ago

try adding

local oldsetup = vim.deepcopy(theme.opts.setup)
theme.opts.setup = function ()
  oldsetup()
  vim.cmd('setlocal buflisted')
end

to your config

AxZxP commented 2 years ago

Ok here is my alpha setup simplified for the sake of readability. I still have the same issue, but I really don't know if I translate well enough your instruction to my config ? In this situation, it doesn't change anything.

local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
  return
end

local dashboard = require "alpha.themes.dashboard"
local oldsetup = vim.deepcopy(dashboard.opts.setup)

dashboard.section.header.val = {
  "foo"
}

dashboard.section.buttons.val = {
  dashboard.button("f", " " .. " Find file", ":Telescope find_files <CR>"),
}

local function footer()
  return "bar"
end

dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = "Type"
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Keyword"
dashboard.opts.opts.noautocmd = true

dashboard.opts.setup = function ()
  oldsetup()
  vim.cmd('setlocal buflisted')
end

alpha.setup(dashboard.opts)
AxZxP commented 2 years ago

Issue unrelated with the plug-in but with an autocmd. Sorry and thank for the help.