feat: dynamic adjustment of dashboard layout padding
This commit is contained in:
+9
-3
@@ -59,13 +59,19 @@ M.alpha = {
|
|||||||
dashboard.section.header.opts.hl = "Conditional" or "AlphaHeader"
|
dashboard.section.header.opts.hl = "Conditional" or "AlphaHeader"
|
||||||
dashboard.section.footer.opts.hl = "AlphaFooter"
|
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||||
|
|
||||||
-- Set up the dashboard layout padding
|
-- Calculate the dashboard layout padding
|
||||||
local padding = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) })
|
local padding = 0
|
||||||
if vim.fn.winheight(0) < 40 then
|
if vim.fn.winheight(0) < 60 then
|
||||||
|
padding = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.1) })
|
||||||
|
elseif vim.fn.winheight(0) < 40 then
|
||||||
padding = 1
|
padding = 1
|
||||||
elseif vim.fn.winheight(0) < 30 then
|
elseif vim.fn.winheight(0) < 30 then
|
||||||
padding = 0
|
padding = 0
|
||||||
|
else
|
||||||
|
padding = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Apply the padding to the dashboard layout
|
||||||
dashboard.opts.layout[1].val = padding
|
dashboard.opts.layout[1].val = padding
|
||||||
|
|
||||||
-- Return the dashboard options
|
-- Return the dashboard options
|
||||||
|
|||||||
Reference in New Issue
Block a user