mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-04 14:34:33 +02:00
fix(toggle): Restore width/height values when closing while maximized is toggled on (#3453)
This commit is contained in:
parent
987bd2207f
commit
8971ea25f9
1 changed files with 11 additions and 0 deletions
|
@ -88,6 +88,17 @@ function M.maximize()
|
||||||
vim.o.winwidth = 999
|
vim.o.winwidth = 999
|
||||||
vim.o.winheight = 999
|
vim.o.winheight = 999
|
||||||
end
|
end
|
||||||
|
-- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that
|
||||||
|
-- `VimLeavePre` might be another consideration? Not sure about differences between the 2
|
||||||
|
vim.api.nvim_create_autocmd("ExitPre", {
|
||||||
|
once = true,
|
||||||
|
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
|
||||||
|
end,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
setmetatable(M, {
|
setmetatable(M, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue