vim on iterm cannot open as full screen

532 Views Asked by At

I wonder about this bottom and left gap, and also wanna remove it

It occurs only when i open "vim", not Iterm itself

Is there any solution?

enter image description here

1

There are 1 best solutions below

0
On

The general principle is that the screen of a terminal emulator is a grid where each cell has the same dimensions as the others and those dimensions are determined by the font and font size used. If the window's dimensions and the grid's dimension are incompatible, then the window can't be filled with the grid and you have that kind of gap.

In this case, the cell dimensions are 16px * 38px so the grid can only fit in a box whose dimensions are a multiple of 16 in width and a multiple of 38 in height.

Now, your screen's dimensions appear to be 1630px * 2862px, which is rather unusual. The width is not a multiple of 16 and the height is not a multiple of 38, so, with your current font settings it is impossible to fill the screen.

For that to be theoretically possible, you would need font settings that make individual cells 16.3px wide and 38.16px tall, or some other "impossible" ratio.

Note that you also have a padding, here, that effectively prevents the grid to ever fill the window anyway.

None of that is really a problem when the program you run in your terminal emulator doesn't paint the background of those cells but your Vim colorscheme does, which makes the effect described above apparent.

The only practical workarounds are:

  • Define the same background in Vim and in your terminal emulator.
  • Make Vim's background transparent.