The struggle

Not-so-popular StackOverflow question reads like this:

“How make Vim fill Terminal window?”.

It doesn’t get much traction or attention. My guess is that people either (1) know how to “fix” it (although the easy way out is not really a fix) or (2) simply live with it, thinking it’s impossible to get around this.

Ugly borders around the Vim screen don’t match the color scheme at all. It breaks immersion and distracts me heavily.

The first and most common option is what I call the easy way out, like user romainl describes on his answer.

You have only two solutions: - give your terminal emulator’s background and Vim’s background the same color, - or remove Vim’s background color.

And that is a fine way to go about things. It’s very likely that you can achieve what you want this way and live with it forever.

If you’re using a recent terminal emulator like Tilix, this can even be achieved painlessly using the graphical interface (which is the best one I’ve used so far, I must say). Not a single command required.

Easily set up your whole color scheme for each profile using Tilix, and change it as you go.

Problems, however, begin to arise when you constantly change your color schemes like me. It’s bothersome (sometimes nonviable) to keep changing the terminal’s palette to fit Vim or anything else running inside of it.

Suppose you also could have different panes in the same window using different color schemes… How do you solve that? What about applications on different tabs, which share the same profile?

Sometimes I’m in fullscreen and I simply don’t want to reach for the mouse to do what I want to do. In the case you’re not lucky to have something handy like Tilix’s color management at your disposal, it’s nonviable or outright impossible to keep track of all this in the middle of work.

Based on what I’ve read so far, this issue happens because Vim and other “internal-pane-like” terminal applications like tmux draw themselves by lines and columns, where the size of the cell is the size of your font’s glyph box scaled by your font size. If your rows and columns don’t perfectly divide by your terminal’s screen dimensions, it obviously won’t take over the remaining space — otherwise, what, it would draw half a line? Or 1/3 of a column? That doesn’t make sense.

I thought this can be explained easily using spreadsheets.

Imagine your terminal’s screen is like this spreadsheet. Line 29 and column K can’t be filled because your desired rows’ and columns’ (font) sizes amounts to something bigger than what the screen has left. The concept can be observed in practice by changing your terminal’s font size, if it is supported.

No, I don’t use a red background. This is only for demonstration purposes.

Pay attention to the borders. You can clearly notice that as I change the font size, tmux recalculates it’s column and row sizes to fit as much of the screen as possible, but it can’t divide perfectly by the amount of screen available.