feat(nvim): minify copnfig

This commit is contained in:
Barrett Ruth 2026-03-07 22:55:22 -05:00
parent 772322333c
commit 58703c4bf8
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 79 additions and 38 deletions

View file

@ -0,0 +1,39 @@
-- https://github.com/echasnovski/mini.misc/blob/main/lua/mini/misc.lua#L838
---@type integer?
local zoom_winid = nil
local function zoom()
if zoom_winid and vim.api.nvim_win_is_valid(zoom_winid) then
vim.api.nvim_win_close(zoom_winid, true)
zoom_winid = nil
return
end
local cfg = {
relative = 'editor',
row = 0,
col = 0,
width = vim.o.columns,
height = vim.o.lines - vim.o.cmdheight,
border = 'none',
}
zoom_winid = vim.api.nvim_open_win(0, true, cfg)
vim.cmd.normal('zz', { bang = true })
vim.api.nvim_create_autocmd('VimResized', {
group = vim.api.nvim_create_augroup('Zoom', { clear = true }),
callback = function()
if not (zoom_winid and vim.api.nvim_win_is_valid(zoom_winid)) then
return
end
vim.api.nvim_win_set_config(zoom_winid, {
relative = 'editor',
row = 0,
col = 0,
width = vim.o.columns,
height = vim.o.lines - vim.o.cmdheight,
})
end,
})
end
vim.keymap.set('n', '<c-w>m', zoom)