summaryrefslogtreecommitdiffstats
path: root/after/plugin/startpage.lua
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-06-26 11:36:34 -0400
committerSquibid <me@zacharyscheiman.com>2023-06-26 11:36:34 -0400
commit38ea991bb8a507eb636b15931a2f1c7e89a8a9d4 (patch)
tree2d7c0dcb8dc1580eb3bdf624c66ff2a83c5d7236 /after/plugin/startpage.lua
parent9e694c03721af13a31aedbfc365203cf66b370b4 (diff)
downloadnvim-38ea991bb8a507eb636b15931a2f1c7e89a8a9d4.tar.gz
nvim-38ea991bb8a507eb636b15931a2f1c7e89a8a9d4.tar.bz2
nvim-38ea991bb8a507eb636b15931a2f1c7e89a8a9d4.zip
add startpage resizing
prob doesn't work, but I'm too lazy to check
Diffstat (limited to 'after/plugin/startpage.lua')
-rw-r--r--after/plugin/startpage.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/after/plugin/startpage.lua b/after/plugin/startpage.lua
index 2f12e56..1cdc848 100644
--- a/after/plugin/startpage.lua
+++ b/after/plugin/startpage.lua
@@ -3,6 +3,11 @@ if not status_ok then
return
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
local function button(sc, txt, keybind)
local opts = {
@@ -12,6 +17,7 @@ local function button(sc, txt, keybind)
width = 80,
align_shortcut = "right",
hl_shortcut = "Keyword",
+ redraw_on_resize = false,
}
local function on_press()
local key = vim.api.nvim_replace_termcodes(keybind .. "<Ignore>", true, false, true)
@@ -69,3 +75,13 @@ if R.width <= 119 then
}
}
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
+})