Comment by sltkr
For the rectangle minimization problem: your problem seems to differ from the one discussed on StackOverflow in that the SO thread discusses partitioning into non-overlapping rectangles, while your Vim project allows overlap.
I wouldn't be surprised if your problem turns out to be much easier to solve optimally.
Actually, from an algorithmic standpoint it's the opposite: the minimum cover problem (where overlap is allowed) is NP-hard whereas the minimum partition problem (where overlap is NOT allowed) has polynomial-time algorithms. "An Algorithm for Covering Polygons with Rectangles" by Franzblau and Kleitman 1984: https://core.ac.uk/download/pdf/82333912.pdf
However, that's of course just an academic tangent - the theoretical results don't necessarily imply that one problem is easier than the other when you're just getting something to work for an afternoon project.