From a23d955656dc4073c255bbcd7d9f47edbdee49ba Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 21 Aug 2022 17:26:34 +0530 Subject: [PATCH] plugins: alpha: Move alpha related cmd to alpha config this special handling of statusline should only be done if alpha plugin is used --- lua/core/init.lua | 15 --------------- lua/plugins/configs/alpha.lua | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lua/core/init.lua b/lua/core/init.lua index 95dfd5f..f2ab2be 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -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() diff --git a/lua/plugins/configs/alpha.lua b/lua/plugins/configs/alpha.lua index 6ddb0c2..b91c233 100644 --- a/lua/plugins/configs/alpha.lua +++ b/lua/plugins/configs/alpha.lua @@ -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, +})