mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 09:48:59 +02:00
fix(toggle): un-maximize when quiting Neovim
This commit is contained in:
parent
90e68edfe7
commit
1c583650e6
1 changed files with 7 additions and 3 deletions
|
@ -73,8 +73,13 @@ function M.inlay_hints(buf, value)
|
|||
end
|
||||
end
|
||||
|
||||
---@type {width:number, height:number}?
|
||||
M._maximized = nil
|
||||
function M.maximize()
|
||||
---@param state boolean?
|
||||
function M.maximize(state)
|
||||
if state == (M._maximized ~= nil) then
|
||||
return
|
||||
end
|
||||
if M._maximized then
|
||||
vim.o.winwidth = M._maximized.width
|
||||
vim.o.winheight = M._maximized.height
|
||||
|
@ -95,8 +100,7 @@ function M.maximize()
|
|||
group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }),
|
||||
desc = "Restore width/height when close Neovim while maximized",
|
||||
callback = function()
|
||||
vim.o.winwidth = M._maximized.width
|
||||
vim.o.winheight = M._maximized.height
|
||||
M.maximize(false)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue