Strange behavior when resizing with autocmd
thraizz opened this issue · 7 comments
Hi, I am currently trying to get nvim to resize accordingly when I resize the terminal.
I tried to set it up with an autocomand like
autocmd VimResized * <cmd>lua require"focus".resize()<cr>
but this produces a blank screen and then, after what looks like a timeout, redraws without a resize.
Is this related to no window currently being focused? Can I work around this somehow?
Thanks and best regards!
Hey @thraizz I see your issue on my end too.
Noticed that if I hit <esc>
or any key for that matter after resizing my terminal window that the windows resize correctly again.
Perhaps adding an <esc>
at the end of that aucmd there might solve the issue?
Hello,
I have the same issue with the following autocmd :
vim.api.nvim_create_autocmd("VimResized", {
desc = "Resize split.",
group = vim.api.nvim_create_augroup("Focus.nvim", { clear = true }),
pattern = "*",
callback = function(args)
require("focus").resize()
end,
})
There is a message in the :messages with the following error :
Error detected while processing VimResized Autocommands for "*":
Error executing lua callback: ...ck/packer/start/focus.nvim/lua/focus/modules/resizer.lua:68: E592: 'winwidth' cannot be smaller than 'winminwidth'
stack traceback:
[C]: in function '__newindex'
...ck/packer/start/focus.nvim/lua/focus/modules/resizer.lua:68: in function 'split_resizer'
...vim/site/pack/packer/start/focus.nvim/lua/focus/init.lua:54: in function 'resize'
/home/clement/.config/nvim/lua/user/windows/init.lua:46: in function </home/clement/.config/nvim/lua/user/windows/init.lua:43>
Hope this helps :)
Edit :
Naively changing line 68 from
vim.o.winwidth = golden_ratio_width()
to
vim.o.winwidth = math.max(golden_ratio_width(),vim.o.winminwidth)
seems to fix the issue, but I'm not sure it's a proper fix.
Ah yes, this is a common problem. In 0.8 is has been allowed to set winminwidth to 0
This should provide a stable path to fix this problem.
I will have a look
The refactor branch has tests now. We should write tests for resizing vim.
I'm getting the following error trying to open a plenary.nvim popup for lsp code actions:
I'll look into this today - would you mind opening a separate issue and providing a minimal init?