add startpage resizing

prob doesn't work, but I'm too lazy to check
This commit is contained in:
2023-06-26 11:36:34 -04:00
parent fdf2f8616e
commit eb5830f5f0

View File

@ -3,6 +3,11 @@ if not status_ok then
return return
end end
local redraw = alpha.redraw
local win = vim.api.nvim_get_current_win()
local buf = vim.api.nvim_get_current_buf()
local augroup = vim.api.nvim_create_augroup('alpha_recalc', { clear = true })
-- buttons -- buttons
local function button(sc, txt, keybind) local function button(sc, txt, keybind)
local opts = { local opts = {
@ -12,6 +17,7 @@ local function button(sc, txt, keybind)
width = 80, width = 80,
align_shortcut = "right", align_shortcut = "right",
hl_shortcut = "Keyword", hl_shortcut = "Keyword",
redraw_on_resize = false,
} }
local function on_press() local function on_press()
local key = vim.api.nvim_replace_termcodes(keybind .. "<Ignore>", true, false, true) local key = vim.api.nvim_replace_termcodes(keybind .. "<Ignore>", true, false, true)
@ -69,3 +75,13 @@ if R.width <= 119 then
} }
} }
end end
vim.api.nvim_create_autocmd('VimResized', {
group = augroup,
buffer = buf,
callback = function()
if vim.api.nvim_get_current_win() == win then
redraw()
end
end
})