From 8571787d70aa9852148420e5684eed138a2dd8da Mon Sep 17 00:00:00 2001 From: siduck Date: Tue, 10 May 2022 17:41:26 +0530 Subject: [PATCH] add dynamic header padding for dashboard | disable statusline in it --- lua/core/autocmds.lua | 17 ++++++++++++++++- lua/plugins/configs/alpha.lua | 7 ++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index b34ca9d..67be8b7 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -1,4 +1,19 @@ --- local autocmd = vim.api.nvim_create_autocmd +local autocmd = vim.api.nvim_create_autocmd + +-- 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, +}) -- Uncomment this if you want to open nvim with a dir -- autocmd("BufEnter", { diff --git a/lua/plugins/configs/alpha.lua b/lua/plugins/configs/alpha.lua index 8a29061..6a57bd6 100644 --- a/lua/plugins/configs/alpha.lua +++ b/lua/plugins/configs/alpha.lua @@ -74,9 +74,14 @@ options.buttons = { options = require("core.utils").load_override(options, "goolord/alpha-nvim") +-- dynamic header padding +local fn = vim.fn +local marginTopPercent = 0.3 +local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) } + alpha.setup { layout = { - { type = "padding", val = 9 }, + { type = "padding", val = headerPadding }, options.header, { type = "padding", val = 2 }, options.buttons,