Resizing splits depending on the buffer text length?

Hey! Is there any way to resize a split depending on the length of the longest line on the buffer?
Thank you!

You can do it, nvim provides all the functions to do so. One for getting all the lines, then you find the longest, then you check the window size, and then you resize.