make paddings in the layout can be overrided

users can adjust the padding between the top and the header, or the header and buttons.
This commit is contained in:
doubleChu 2022-08-15 22:52:52 +08:00 committed by Sidhanth Rathod
parent 66e2904b68
commit d9cd55fc0f

View file

@ -34,6 +34,11 @@ local function button(sc, txt, keybind)
} }
end end
-- dynamic header padding
local fn = vim.fn
local marginTopPercent = 0.3
local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) }
local options = { local options = {
header = { header = {
@ -71,20 +76,18 @@ local options = {
spacing = 1, spacing = 1,
}, },
}, },
headerPaddingTop = { type = "padding", val = headerPadding },
headerPaddingBottom = { type = "padding", val = 2 },
} }
options = require("core.utils").load_override(options, "goolord/alpha-nvim") 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 { alpha.setup {
layout = { layout = {
{ type = "padding", val = headerPadding }, options.headerPaddingTop,
options.header, options.header,
{ type = "padding", val = 2 }, options.headerPaddingBottom,
options.buttons, options.buttons,
}, },
opts = {}, opts = {},