plugins: alpha: Move alpha related cmd to alpha config

this special handling of statusline should only be done if alpha plugin is used
This commit is contained in:
Akianonymus 2022-08-21 17:26:34 +05:30 committed by Sidhanth Rathod
parent fe9a7b1651
commit a23d955656
2 changed files with 16 additions and 15 deletions

View file

@ -27,21 +27,6 @@ autocmd("VimEnter", {
end,
})
-- Disable statusline in dashboard
autocmd("FileType", {
pattern = "alpha",
callback = function()
vim.opt.laststatus = 0
end,
})
autocmd("BufUnload", {
buffer = 0,
callback = function()
vim.opt.laststatus = 3
end,
})
-- store listed buffers in tab local var
vim.t.bufs = vim.api.nvim_list_bufs()

View file

@ -92,3 +92,19 @@ alpha.setup {
},
opts = {},
}
-- Disable statusline in dashboard
vim.api.nvim_create_autocmd("FileType", {
pattern = "alpha",
callback = function()
-- store current statusline value and use that
local old_laststatus = vim.opt.laststatus
vim.api.nvim_create_autocmd("BufUnload", {
buffer = 0,
callback = function()
vim.opt.laststatus = old_laststatus
end,
})
vim.opt.laststatus = 0
end,
})