bufresize.nvim icon indicating copy to clipboard operation
bufresize.nvim copied to clipboard

Question: allow persistent size for defined buffers?

Open ttytm opened this issue 3 years ago • 2 comments

Hey, there. I hope a quick question is okay here.

I couldn't find out how or if it's possible to prevent a buffer from being resized / allow persistent size for it. E.g., when there is a split with nvimtree while UI resizing happens and this split should keep its size while others will be relatively sized.

Already thank you for the development m8 👍

ttytm avatar Jul 13 '22 13:07 ttytm

Yest, it's quite annoying when NvimTree or Tree in DiffView are resized as well.

D00mch avatar Jul 15 '23 11:07 D00mch

I solved this back then in my personal config using neo-trees event handlers and autocommands.

Storing the tree window id and width when opening it: https://github.com/tenxsoydev/nxvim/blob/e697a0cece986eb595679a214343dec9c27db966/lua/nxvim/plugins/neo-tree.lua#L171-L179

Setting the tree window width to it's size (preserving it) on application window resize: https://github.com/tenxsoydev/nxvim/blob/e697a0cece986eb595679a214343dec9c27db966/lua/nxvim/plugins/neo-tree.lua#L196-L203

Updating it's stored size when resizing the tree window: https://github.com/tenxsoydev/nxvim/blob/e697a0cece986eb595679a214343dec9c27db966/lua/nxvim/plugins/neo-tree.lua#L220

This approach should be reproducible with diffviews hooks or with autocomands for any other window. Maybe that's at least of some help @D00mch.

ttytm avatar Jul 15 '23 14:07 ttytm